Files
mqtt-explorer/src/Model/spec/Edge.spec.ts
Thomas Nordquist 0af3a2ede3 Initial commit
2018-12-28 15:25:25 +01:00

32 lines
761 B
TypeScript

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)
});
});