Initial commit
This commit is contained in:
31
src/Model/spec/Edge.spec.ts
Normal file
31
src/Model/spec/Edge.spec.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Edge, TreeNode } from '../'
|
||||
import { expect } from 'chai';
|
||||
import 'mocha';
|
||||
|
||||
describe('Edge', () => {
|
||||
|
||||
it('should contain a name', () => {
|
||||
let e = new Edge('foo')
|
||||
expect(e.name).to.equal('foo')
|
||||
});
|
||||
|
||||
it('hash should not be empty', () => {
|
||||
let e = new Edge('bar')
|
||||
expect(e.hash().length).to.be.gt(0)
|
||||
});
|
||||
|
||||
it('hash should be stable', () => {
|
||||
let e = new Edge('bar')
|
||||
let previousHash = e.hash()
|
||||
expect(e.hash()).to.eq(previousHash)
|
||||
});
|
||||
|
||||
it('hash should change when parent is present', () => {
|
||||
let foo = new Edge('foo')
|
||||
let bar = new Edge('bar')
|
||||
|
||||
var previousHash = bar.hash()
|
||||
bar.source = new TreeNode(foo, undefined)
|
||||
expect(bar.hash()).to.not.eq(previousHash)
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user