UNPKG

617 BJavaScriptView Raw
1describe('pseudo Graph', () => {
2 const Graph = require('iper').Graph
3
4 const graph = new Graph({ pseudograph: true })
5
6 describe('constructor', () => {
7 it('accepts pseudograph flag and adds it to attributes', () => {
8 graph.pseudograph.should.be.true()
9 })
10
11 it('implies multigraph', () => {
12 graph.multigraph.should.be.true()
13 })
14 })
15
16 describe('addEdge()', () => {
17 it('can create loops', () => {
18 const nodeId = graph.addNode()
19 const nodeIds = [nodeId, nodeId]
20
21 const edgeId = graph.addEdge(nodeIds)
22
23 graph.edges[edgeId].should.be.eql(nodeIds)
24 })
25 })
26})