| 1 |
import { DefaultGraph, Term } from '../src/'; |
| 2 |
|
| 3 |
describe('DefaultGraph', () => { |
| 4 |
describe('The DefaultGraph module', () => { |
| 5 |
it('should be a function', () => { |
| 6 |
DefaultGraph.should.be.a('function'); |
| 7 |
}); |
| 8 |
|
| 9 |
it('should be a DefaultGraph constructor', () => { |
| 10 |
new DefaultGraph().should.be.an.instanceof(DefaultGraph); |
| 11 |
}); |
| 12 |
|
| 13 |
it('should be a Term constructor', () => { |
| 14 |
new DefaultGraph().should.be.an.instanceof(Term); |
| 15 |
}); |
| 16 |
}); |
| 17 |
|
| 18 |
describe('A DefaultGraph instance', () => { |
| 19 |
let defaultGraph; |
| 20 |
before(() => { defaultGraph = new DefaultGraph(); }); |
| 21 |
|
| 22 |
it('should be a DefaultGraph', () => { |
| 23 |
defaultGraph.should.be.an.instanceof(DefaultGraph); |
| 24 |
}); |
| 25 |
|
| 26 |
it('should be a Term', () => { |
| 27 |
defaultGraph.should.be.an.instanceof(Term); |
| 28 |
}); |
| 29 |
|
| 30 |
it('should have term type "DefaultGraph"', () => { |
| 31 |
defaultGraph.termType.should.equal('DefaultGraph'); |
| 32 |
}); |
| 33 |
|
| 34 |
it('should have the empty string as value', () => { |
| 35 |
defaultGraph.should.have.property('value', ''); |
| 36 |
}); |
| 37 |
|
| 38 |
it('should have the empty string as id', () => { |
| 39 |
defaultGraph.should.have.property('id', ''); |
| 40 |
}); |
| 41 |
|
| 42 |
it('should equal another DefaultGraph instance', () => { |
| 43 |
defaultGraph.equals(new DefaultGraph()).should.be.true; |
| 44 |
}); |
| 45 |
|
| 46 |
it('should equal an object with the same term type', () => { |
| 47 |
defaultGraph.equals({ |
| 48 |
termType: 'DefaultGraph', |
| 49 |
}).should.be.true; |
| 50 |
}); |
| 51 |
|
| 52 |
it('should not equal a falsy object', () => { |
| 53 |
defaultGraph.equals(null).should.be.false; |
| 54 |
}); |
| 55 |
|
| 56 |
it('should not equal an object with a different term type', () => { |
| 57 |
defaultGraph.equals({ |
| 58 |
termType: 'Literal', |
| 59 |
}).should.be.false; |
| 60 |
}); |
| 61 |
|
| 62 |
it('should provide a JSON representation', () => { |
| 63 |
defaultGraph.toJSON().should.deep.equal({ |
| 64 |
termType: 'DefaultGraph', |
| 65 |
value: '', |
| 66 |
}); |
| 67 |
}); |
| 68 |
}); |
| 69 |
}); |