1 | describe('multi Graph', () => {
|
2 | const should = require('should')
|
3 |
|
4 | const Graph = require('iper').Graph
|
5 |
|
6 | const graph = new Graph({ multigraph: true })
|
7 |
|
8 | describe('constructor', () => {
|
9 | it('accepts multigraph flag and adds it to attributes', () => {
|
10 | graph.multigraph.should.be.true
|
11 | })
|
12 | })
|
13 |
|
14 | describe('addEdge()', () => {
|
15 | it('cannot add duplicated edges', () => {
|
16 | const nodeId1 = graph.addNode()
|
17 | const nodeId2 = graph.addNode()
|
18 |
|
19 | const edgeId1 = graph.addEdge([nodeId1, nodeId2])
|
20 | const edgeId2 = graph.addEdge([nodeId1, nodeId2])
|
21 |
|
22 | should.deepEqual(graph.edges[edgeId1], graph.edges[edgeId2])
|
23 | edgeId1.should.be.not.equal(edgeId2)
|
24 | })
|
25 | })
|
26 | })
|