2018-07-15 14:04:27 +00:00
|
|
|
import { tap, expect } from '@pushrocks/tapbundle';
|
|
|
|
import * as lik from '../ts/index';
|
2017-11-20 08:26:13 +00:00
|
|
|
|
2018-07-15 14:04:27 +00:00
|
|
|
let testTree = new lik.Tree<TestClass>();
|
2017-11-20 08:26:13 +00:00
|
|
|
|
|
|
|
class TestClass {
|
2018-07-15 14:04:27 +00:00
|
|
|
constructor(public hey: string) {
|
2017-11-20 08:26:13 +00:00
|
|
|
// nothing here
|
|
|
|
}
|
|
|
|
}
|
2018-07-15 14:04:27 +00:00
|
|
|
let testInstance = new TestClass('first');
|
2017-11-20 08:26:13 +00:00
|
|
|
|
|
|
|
tap.test('create a valid tree instance', async () => {
|
2018-07-15 14:04:27 +00:00
|
|
|
testTree = new lik.Tree();
|
|
|
|
expect(testTree).to.be.instanceOf(lik.Tree);
|
|
|
|
});
|
2017-11-20 08:26:13 +00:00
|
|
|
|
|
|
|
tap.test('should insert an object', async () => {
|
2018-07-15 14:04:27 +00:00
|
|
|
testTree.initialize(testInstance);
|
|
|
|
let resultArray = testTree.treeToArray(testInstance, {});
|
|
|
|
expect(resultArray).to.contain(testInstance);
|
|
|
|
});
|
2017-11-20 08:26:13 +00:00
|
|
|
|
2018-07-15 14:04:27 +00:00
|
|
|
tap.start();
|