fix(core): update

This commit is contained in:
Philipp Kunz 2022-01-24 05:22:49 +01:00
parent e551a68237
commit b17dd2ed64
8 changed files with 3976 additions and 3147 deletions

7039
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,12 +20,12 @@
},
"homepage": "https://gitlab.com/pushrocks/lik#README",
"devDependencies": {
"@gitzone/tsbuild": "^2.1.27",
"@gitzone/tsbundle": "^1.0.87",
"@gitzone/tsrun": "^1.2.17",
"@gitzone/tstest": "^1.0.57",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^16.9.1",
"@gitzone/tsbuild": "^2.1.29",
"@gitzone/tsbundle": "^1.0.89",
"@gitzone/tsrun": "^1.2.18",
"@gitzone/tstest": "^1.0.60",
"@pushrocks/tapbundle": "^4.0.0",
"@types/node": "^17.0.10",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
@ -33,8 +33,8 @@
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartmatch": "^1.0.7",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.19",
"@pushrocks/smarttime": "^3.0.38",
"@pushrocks/smartrx": "^2.0.20",
"@pushrocks/smarttime": "^3.0.43",
"@types/minimatch": "^3.0.5",
"symbol-tree": "^3.2.4"
},

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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(

View File

@ -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 () => {