use jest for CI

This commit is contained in:
xiaofeng.mxf
2020-01-20 19:57:38 +08:00
parent d3c306b976
commit 699ac3dbfa
69 changed files with 967 additions and 3353 deletions

20
test/lib/util.spec.js Normal file
View File

@@ -0,0 +1,20 @@
const util = require('../../lib/util');
describe('utils', () => {
it('getFreePort', async () => {
const count = 100;
const tasks = [];
for (let i = 1; i <= count; i++) {
tasks.push(util.getFreePort());
}
await Promise.all(tasks)
.then((results) => {
// ensure ports are unique
const portMap = {};
results.map((portNumber) => {
portMap[portNumber] = true;
});
expect(Object.keys(portMap).length).toEqual(count);
});
});
});