Skip to content

Commit

Permalink
added test for generateId
Browse files Browse the repository at this point in the history
  • Loading branch information
olton committed Oct 23, 2023
1 parent bdd1528 commit 95c7632
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions easydata.js/packs/core/test/helpers_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,31 @@ describe("Functions", ()=> {
utils.assignDeep(object1, object2);
expect(object1.arr[0].data.get).toEqual(object2.arr[0].data.get);
});

it('generateId test', async () => {
const array = []

const gen_pack = () => {
for (let i = 0; i < 100; i++) {
array.push(utils.generateId('id'))
}
}

const delay = (ms: number) => {
return new Promise((resolve, reject) => {
setTimeout(resolve, ms);
});
}

gen_pack()

for (let j = 0; j < 5; j++) {
await delay(1000)
gen_pack()
}

const test = new Set(array)

expect(array.length).toEqual(test.size)
}, 20000)
});
4 changes: 2 additions & 2 deletions playground/setup_dev.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cd .\EasyDataAspNetCoreTest01

@echo ---- installing NPM packages for EasyDataAspNetCoreTest01 ----
call npm install
call npm install --legacy-peer-deps

@echo ---- setting symlinks to the @easydata source code ----
cd node_modules
Expand All @@ -20,7 +20,7 @@ cd ..\..\..
cd .\EasyDataAspNetCoreTest02

@echo ---- installing NPM packages for EasyDataAspNetCoreTest02 ----
call npm install
call npm install --legacy-peer-deps

@echo ---- setting symlinks to the @easydata source code ----
cd node_modules
Expand Down

0 comments on commit 95c7632

Please sign in to comment.