feat: internal messaging strict worker id checking
[poolifier.git] / tests / pools / cluster / fixed.test.js
index 48455f18011ded1507929a5a74bb06077fda45af..f9423e731cbd93a20417b2124d7f4c4f4c8b783d 100644 (file)
@@ -74,7 +74,7 @@ describe('Fixed cluster pool test suite', () => {
 
   it('Verify that is possible to invoke the execute() method without input', async () => {
     const result = await pool.execute()
-    expect(result).toBe(false)
+    expect(result).toStrictEqual({ ok: 1 })
   })
 
   it("Verify that 'busy' event is emitted", async () => {
@@ -147,7 +147,6 @@ describe('Fixed cluster pool test suite', () => {
     expect(typeof inError === 'string').toBe(true)
     expect(inError).toBe('Error Message from ClusterWorker')
     expect(taskError).toStrictEqual({
-      workerId: expect.any(Number),
       message: 'Error Message from ClusterWorker',
       data
     })
@@ -174,7 +173,6 @@ describe('Fixed cluster pool test suite', () => {
     expect(typeof inError === 'string').toBe(true)
     expect(inError).toBe('Error Message from ClusterWorker:async')
     expect(taskError).toStrictEqual({
-      workerId: expect.any(Number),
       message: 'Error Message from ClusterWorker:async',
       data
     })
@@ -230,7 +228,7 @@ describe('Fixed cluster pool test suite', () => {
       './tests/worker-files/cluster/testWorker.js'
     )
     const res = await pool1.execute()
-    expect(res).toBe(false)
+    expect(res).toStrictEqual({ ok: 1 })
     // We need to clean up the resources after our test
     await pool1.destroy()
   })
@@ -239,6 +237,6 @@ describe('Fixed cluster pool test suite', () => {
     expect(
       () =>
         new FixedClusterPool(0, './tests/worker-files/cluster/testWorker.js')
-    ).toThrowError('Cannot instantiate a fixed pool with no worker')
+    ).toThrowError('Cannot instantiate a fixed pool with zero worker')
   })
 })