From: Jérôme Benoit Date: Mon, 28 Aug 2023 10:19:23 +0000 (+0200) Subject: test: improve UTs X-Git-Tag: v2.6.37~17 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=bb9423b78d11f9420b9b2a8cb865ea8c1315e642;p=poolifier.git test: improve UTs Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index 5435565a..be745d94 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -53,7 +53,6 @@ describe('Abstract pool test suite', () => { expect(pool.starting).toBe(false) expect(pool.started).toBe(true) await pool.destroy() - expect(pool.started).toBe(false) }) it('Verify that filePath is checked', () => { diff --git a/tests/pools/cluster/dynamic.test.js b/tests/pools/cluster/dynamic.test.js index 44d543ec..8f4d2c9a 100644 --- a/tests/pools/cluster/dynamic.test.js +++ b/tests/pools/cluster/dynamic.test.js @@ -61,6 +61,8 @@ describe('Dynamic cluster pool test suite', () => { pool.emitter.on(PoolEvents.destroy, () => ++poolDestroy) await pool.destroy() const numberOfExitEvents = await exitPromise + expect(pool.started).toBe(false) + expect(pool.workerNodes.length).toBe(0) expect(numberOfExitEvents).toBe(min) expect(poolDestroy).toBe(1) }) diff --git a/tests/pools/cluster/fixed.test.js b/tests/pools/cluster/fixed.test.js index 04af6384..6edfcd67 100644 --- a/tests/pools/cluster/fixed.test.js +++ b/tests/pools/cluster/fixed.test.js @@ -246,6 +246,8 @@ describe('Fixed cluster pool test suite', () => { pool.emitter.on(PoolEvents.destroy, () => ++poolDestroy) await pool.destroy() const numberOfExitEvents = await exitPromise + expect(pool.started).toBe(false) + expect(pool.workerNodes.length).toBe(0) expect(numberOfExitEvents).toBe(numberOfWorkers) expect(poolDestroy).toBe(1) }) diff --git a/tests/pools/thread/dynamic.test.js b/tests/pools/thread/dynamic.test.js index 2f3f4510..e30099dd 100644 --- a/tests/pools/thread/dynamic.test.js +++ b/tests/pools/thread/dynamic.test.js @@ -61,6 +61,8 @@ describe('Dynamic thread pool test suite', () => { pool.emitter.on(PoolEvents.destroy, () => ++poolDestroy) await pool.destroy() const numberOfExitEvents = await exitPromise + expect(pool.started).toBe(false) + expect(pool.workerNodes.length).toBe(0) expect(numberOfExitEvents).toBe(min) expect(poolDestroy).toBe(1) }) diff --git a/tests/pools/thread/fixed.test.js b/tests/pools/thread/fixed.test.js index 09363b84..065774ec 100644 --- a/tests/pools/thread/fixed.test.js +++ b/tests/pools/thread/fixed.test.js @@ -276,6 +276,8 @@ describe('Fixed thread pool test suite', () => { pool.emitter.on(PoolEvents.destroy, () => ++poolDestroy) await pool.destroy() const numberOfExitEvents = await exitPromise + expect(pool.started).toBe(false) + expect(pool.workerNodes.length).toBe(0) expect(numberOfExitEvents).toBe(numberOfThreads) expect(poolDestroy).toBe(1) }) diff --git a/tests/utils.test.js b/tests/utils.test.js index 2c41b692..57bd2611 100644 --- a/tests/utils.test.js +++ b/tests/utils.test.js @@ -45,7 +45,7 @@ describe('Utils test suite', () => { expect(getWorkerId(clusterWorker)).toBe(clusterWorker.id) }) - it.skip('Verify sleep() behavior', async () => { + it('Verify sleep() behavior', async () => { const start = performance.now() await sleep(1000) const elapsed = performance.now() - start