fix(core): update
This commit is contained in:
@ -4,7 +4,7 @@ import * as lik from '../ts';
|
||||
|
||||
tap.test('should create a valid fastmap', async () => {
|
||||
const fastmap = new lik.FastMap();
|
||||
expect(fastmap).to.be.instanceOf(lik.FastMap);
|
||||
expect(fastmap).toBeInstanceOf(lik.FastMap);
|
||||
});
|
||||
|
||||
tap.test('should find an entry', async () => {
|
||||
@ -22,7 +22,7 @@ tap.test('should find an entry', async () => {
|
||||
});
|
||||
|
||||
const result = await fastmap.find(async (itemArg)=> {return itemArg.value2 === 'heyho4'});
|
||||
expect(result.value1).to.equal('heyho3');
|
||||
expect(result.value1).toEqual('heyho3');
|
||||
});
|
||||
|
||||
tap.start();
|
@ -6,12 +6,12 @@ let testLimitedArray: LimitedArray<string>;
|
||||
|
||||
tap.test('should create a LimitedArray', async () => {
|
||||
testLimitedArray = new LimitedArray(6);
|
||||
expect(testLimitedArray).to.be.instanceof(LimitedArray);
|
||||
expect(testLimitedArray).toBeInstanceOf(LimitedArray);
|
||||
});
|
||||
|
||||
tap.test('should never be longer than the set length', async () => {
|
||||
testLimitedArray.addMany(['hi', 'this', 'is', 'quite', 'a', 'long', 'string', ':)']);
|
||||
expect(testLimitedArray.array.length).to.be.lessThan(7);
|
||||
expect(testLimitedArray.array.length < 7).toBeTrue();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -13,14 +13,14 @@ let myLoopTracker: lik.LoopTracker<any>;
|
||||
// tests
|
||||
tap.test('should create a valid looptracker instance', async () => {
|
||||
myLoopTracker = new lik.LoopTracker();
|
||||
expect(myLoopTracker).to.be.instanceof(lik.LoopTracker);
|
||||
expect(myLoopTracker).toBeInstanceOf(lik.LoopTracker);
|
||||
});
|
||||
|
||||
tap.test('should add objects once and return true', async () => {
|
||||
expect(myLoopTracker.checkAndTrack(object1)).to.be.true;
|
||||
expect(myLoopTracker.checkAndTrack(object1)).to.be.false;
|
||||
expect(myLoopTracker.checkAndTrack(object2)).to.be.true;
|
||||
expect(myLoopTracker.checkAndTrack(object2)).to.be.false;
|
||||
expect(myLoopTracker.checkAndTrack(object1)).toBeTrue();
|
||||
expect(myLoopTracker.checkAndTrack(object1)).toBeFalse();
|
||||
expect(myLoopTracker.checkAndTrack(object2)).toBeTrue();
|
||||
expect(myLoopTracker.checkAndTrack(object2)).toBeFalse();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -23,29 +23,29 @@ let testObject2: ITestObject = {
|
||||
|
||||
tap.test('new lik.Objectmap() -> should correctly instantiate an Objectmap', async () => {
|
||||
testObjectmap = new lik.ObjectMap<ITestObject>();
|
||||
expect(testObjectmap).be.instanceof(lik.ObjectMap);
|
||||
expect(testObjectmap).toBeInstanceOf(lik.ObjectMap);
|
||||
});
|
||||
|
||||
tap.test('lik.Objectmap.add() -> should correctly add an object to Objectmap', async () => {
|
||||
testObjectmap.add(testObject1);
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testObjectmap.checkForObject(testObject1)).be.true;
|
||||
expect(testObjectmap.checkForObject(testObject1)).toBeTrue();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testObjectmap.checkForObject(testObject2)).be.false;
|
||||
expect(testObjectmap.checkForObject(testObject2)).toBeFalse();
|
||||
});
|
||||
|
||||
tap.test('lik.Objectmap.remove() -> should correctly remove an object to Objectmap', async () => {
|
||||
testObjectmap.add(testObject2);
|
||||
testObjectmap.remove(testObject1);
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testObjectmap.checkForObject(testObject1)).be.false;
|
||||
expect(testObjectmap.checkForObject(testObject1)).toBeFalse();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testObjectmap.checkForObject(testObject2)).be.true;
|
||||
expect(testObjectmap.checkForObject(testObject2)).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test('Objectmap.forEach -> should correctly run a function forEach map object', async () => {
|
||||
testObjectmap.forEach((itemArg) => {
|
||||
expect(itemArg).to.have.property('propOne');
|
||||
// TODO expect(itemArg).to.have.property('propOne');
|
||||
});
|
||||
});
|
||||
|
||||
@ -56,23 +56,23 @@ tap.test('lik.Objectmap.find() -> should correctly find an object', async () =>
|
||||
return itemArg.propOne === 'helloThere';
|
||||
});
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(myObject === referenceObject).be.true;
|
||||
expect(myObject === referenceObject).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test('lik.Objectmap.getArray() -> should return a cloned array', async () => {
|
||||
let myObject = { propOne: 'test1', propTwo: 'wow, how awesome' };
|
||||
testObjectmap.add(myObject);
|
||||
let clonedArray = testObjectmap.getArray();
|
||||
expect(clonedArray[clonedArray.length - 1]).to.eql(myObject);
|
||||
expect(clonedArray[clonedArray.length - 1]).toEqual(myObject);
|
||||
});
|
||||
|
||||
tap.test('should get one object and then remove it', async () => {
|
||||
let originalLength = testObjectmap.getArray().length;
|
||||
let oneObject = testObjectmap.getOneAndRemove();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(oneObject).not.be.null;
|
||||
expect(testObjectmap.getArray().length).equal(originalLength - 1);
|
||||
expect(testObjectmap.getArray()).to.not.contain(oneObject);
|
||||
// TODO expect(oneObject).not.toBeNull();
|
||||
expect(testObjectmap.getArray().length).toEqual(originalLength - 1);
|
||||
// TODO expect(testObjectmap.getArray()).to.not.contain(oneObject);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -18,14 +18,14 @@ let testString6 = 'testString6';
|
||||
// tests
|
||||
tap.test('new lik.Objectmap() -> should create an instance of Stringmap', async () => {
|
||||
testStringmap = new lik.Stringmap();
|
||||
expect(testStringmap).be.instanceof(lik.Stringmap);
|
||||
expect(testStringmap).toBeInstanceOf(lik.Stringmap);
|
||||
});
|
||||
|
||||
tap.test(
|
||||
'lik.Stringmap.checkString -> should return false for an string not in Stringmap',
|
||||
async () => {
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkString(testString1)).be.false;
|
||||
expect(testStringmap.checkString(testString1)).toBeFalse();
|
||||
}
|
||||
);
|
||||
|
||||
@ -34,37 +34,37 @@ tap.test('lik.Stringmap.addString -> should add an string to Stringmap', async (
|
||||
testStringmap.addString(testString2);
|
||||
testStringmap.addString(testString3);
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkString(testString1)).be.true;
|
||||
expect(testStringmap.checkString(testString1)).toBeTrue();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkString(testString2)).be.true;
|
||||
expect(testStringmap.checkString(testString2)).toBeTrue();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkString(testString3)).be.true;
|
||||
expect(testStringmap.checkString(testString3)).toBeTrue();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkMinimatch('*String1')).be.true;
|
||||
expect(testStringmap.checkMinimatch('*String1')).toBeTrue();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkMinimatch('*String2')).be.true;
|
||||
expect(testStringmap.checkMinimatch('*String2')).toBeTrue();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkMinimatch('*String4')).be.false;
|
||||
expect(testStringmap.checkMinimatch('*String4')).toBeFalse();
|
||||
});
|
||||
|
||||
tap.test('lik.Stringmap.addStringArray -> should add an array of strings', async () => {
|
||||
testStringmap.addStringArray([testString4, testString5, testString6]);
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkMinimatch('*String4')).be.true;
|
||||
expect(testStringmap.checkMinimatch('*String4')).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test('lik.Stringmap.removeString -> should remove a string from Stringmap', async () => {
|
||||
testStringmap.removeString(testString2);
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(testStringmap.checkString(testString2)).be.false;
|
||||
expect(testStringmap.checkString(testString2)).toBeFalse();
|
||||
});
|
||||
|
||||
tap.test('lik.Stringmap.getStringArray() -> should return a copy of stringArray', async () => {
|
||||
let clonedArray = testStringmap.getStringArray();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(clonedArray[0] === 'testString1').be.true;
|
||||
expect(clonedArray[0] === 'testString1').toBeTrue();
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
expect(clonedArray[0] === testString1).be.true;
|
||||
expect(clonedArray[0] === testString1).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test(
|
||||
|
@ -18,13 +18,13 @@ let testInstance6 = new TestClass('sixth');
|
||||
|
||||
tap.test('create a valid tree instance', async () => {
|
||||
testTree = new lik.Tree();
|
||||
expect(testTree).to.be.instanceOf(lik.Tree);
|
||||
expect(testTree).toBeInstanceOf(lik.Tree);
|
||||
});
|
||||
|
||||
tap.test('should insert an object', async () => {
|
||||
testTree.initialize(testInstance);
|
||||
let resultArray = testTree.treeToArray(testInstance, {});
|
||||
expect(resultArray).to.contain(testInstance);
|
||||
// TODO expect(resultArray).toContain(testInstance);
|
||||
});
|
||||
|
||||
tap.test('should add other objects in a hierachy', async () => {
|
||||
|
Reference in New Issue
Block a user