test: check that event listener are remove at destroy
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 26 Nov 2023 09:46:20 +0000 (10:46 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 26 Nov 2023 09:46:20 +0000 (10:46 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
tests/pools/cluster/dynamic.test.mjs
tests/pools/cluster/fixed.test.mjs
tests/pools/thread/dynamic.test.mjs
tests/pools/thread/fixed.test.mjs

index 2c542375e5f5fda1b83daea9fe29c3d205150f49..93f995fcb4cfefd215ea90e348ec1e4023643745 100644 (file)
@@ -67,6 +67,7 @@ describe('Dynamic cluster pool test suite', () => {
     await pool.destroy()
     const numberOfExitEvents = await exitPromise
     expect(pool.started).toBe(false)
+    expect(pool.emitter.eventNames()).toStrictEqual([])
     expect(pool.readyEventEmitted).toBe(false)
     expect(pool.workerNodes.length).toBe(0)
     expect(numberOfExitEvents).toBe(min)
index a79be4a39a7b37a6b5d2c3690786103fb25662f0..de188a2e196edcc9c5f530ae93598416c66874e0 100644 (file)
@@ -269,6 +269,7 @@ describe('Fixed cluster pool test suite', () => {
     await pool.destroy()
     const numberOfExitEvents = await exitPromise
     expect(pool.started).toBe(false)
+    expect(pool.emitter.eventNames()).toStrictEqual([])
     expect(pool.readyEventEmitted).toBe(false)
     expect(pool.workerNodes.length).toBe(0)
     expect(numberOfExitEvents).toBe(numberOfWorkers)
index ec9d51defd5ad1cc4094a02abf8aeabc4dbeeeba..bf7f95278e861e0f1239d0ea36d0645399e56c3e 100644 (file)
@@ -67,6 +67,7 @@ describe('Dynamic thread pool test suite', () => {
     await pool.destroy()
     const numberOfExitEvents = await exitPromise
     expect(pool.started).toBe(false)
+    expect(pool.emitter.eventNames()).toStrictEqual([])
     expect(pool.readyEventEmitted).toBe(false)
     expect(pool.workerNodes.length).toBe(0)
     expect(numberOfExitEvents).toBe(min)
index 6a435ffea4b7908a4b09f0fd8ff73f44810985b1..a7c4a48f73a4252414b2323db4a2b5e4ac9383c9 100644 (file)
@@ -301,6 +301,7 @@ describe('Fixed thread pool test suite', () => {
     const numberOfExitEvents = await exitPromise
     expect(pool.started).toBe(false)
     expect(pool.readyEventEmitted).toBe(false)
+    expect(pool.emitter.eventNames()).toStrictEqual([])
     expect(pool.workerNodes.length).toBe(0)
     expect(numberOfExitEvents).toBe(numberOfThreads)
     expect(poolDestroy).toBe(1)