fix: fix pool ready event emission
[poolifier.git] / tests / pools / thread / fixed.test.mjs
index fd7f5935697d9e2074d1f9734b6b2345159e9775..6b46512ccd4184404d41087e60884fbf814364aa 100644 (file)
@@ -202,8 +202,9 @@ describe('Fixed thread pool test suite', () => {
       error = e
     }
     expect(result).toStrictEqual({ ok: 1 })
-    expect(error).toStrictEqual(
-      new TypeError('Found invalid object in transferList')
+    expect(error).toBeInstanceOf(Error)
+    expect(error.message).toMatch(
+      /Found invalid (object|value) in transferList/
     )
   })
 
@@ -292,6 +293,7 @@ describe('Fixed thread pool test suite', () => {
     await pool.destroy()
     const numberOfExitEvents = await exitPromise
     expect(pool.started).toBe(false)
+    expect(pool.readyEventEmitted).toBe(false)
     expect(pool.workerNodes.length).toBe(0)
     expect(numberOfExitEvents).toBe(numberOfThreads)
     expect(poolDestroy).toBe(1)
@@ -341,6 +343,6 @@ describe('Fixed thread pool test suite', () => {
   it('Verify that a pool with zero worker fails', () => {
     expect(
       () => new FixedThreadPool(0, './tests/worker-files/thread/testWorker.mjs')
-    ).toThrowError('Cannot instantiate a fixed pool with zero worker')
+    ).toThrow('Cannot instantiate a fixed pool with zero worker')
   })
 })