From b04bd0f17e1ef9d2b5bd13ec69405f03ee86ff51 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 24 Sep 2023 21:27:21 +0200 Subject: [PATCH] test: add more event emitter tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/pools/cluster/fixed.test.js | 2 +- tests/pools/thread/fixed.test.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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) -- 2.43.0