From: Jérôme Benoit Date: Sun, 24 Sep 2023 19:27:21 +0000 (+0200) Subject: test: add more event emitter tests X-Git-Tag: v2.7.4~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b04bd0f17e1ef9d2b5bd13ec69405f03ee86ff51;p=poolifier.git test: add more event emitter tests Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/cluster/fixed.test.js b/tests/pools/cluster/fixed.test.js index 0994e9e90..9b79f6ed8 100644 --- a/tests/pools/cluster/fixed.test.js +++ b/tests/pools/cluster/fixed.test.js @@ -97,8 +97,8 @@ describe('Fixed cluster pool test suite', () => { }) it("Verify that 'busy' event is emitted", async () => { - expect(pool.emitter.eventNames()).toStrictEqual([]) const promises = new Set() + expect(pool.emitter.eventNames()).toStrictEqual([]) let poolBusy = 0 pool.emitter.on(PoolEvents.busy, () => ++poolBusy) expect(pool.emitter.eventNames()).toStrictEqual([PoolEvents.busy]) diff --git a/tests/pools/thread/fixed.test.js b/tests/pools/thread/fixed.test.js index 42549b63c..acd944067 100644 --- a/tests/pools/thread/fixed.test.js +++ b/tests/pools/thread/fixed.test.js @@ -282,8 +282,13 @@ describe('Fixed thread pool test suite', () => { it('Shutdown test', async () => { const exitPromise = waitWorkerEvents(pool, 'exit', numberOfThreads) + expect(pool.emitter.eventNames()).toStrictEqual([PoolEvents.busy]) let poolDestroy = 0 pool.emitter.on(PoolEvents.destroy, () => ++poolDestroy) + expect(pool.emitter.eventNames()).toStrictEqual([ + PoolEvents.busy, + PoolEvents.destroy + ]) await pool.destroy() const numberOfExitEvents = await exitPromise expect(pool.started).toBe(false)