test: fix dynamic cluster pool with zero worker test
[poolifier.git] / tests / pools / cluster / dynamic.test.mjs
index d2a250c15b6b1032a6687634caa6cc905e115e00..540223bf2840ab384e11d4b077a5f84cd27a8144 100644 (file)
@@ -157,15 +157,17 @@ describe('Dynamic cluster pool test suite', () => {
     await pool.destroy()
   })
 
-  it.skip('Verify that a pool with zero worker works', async () => {
-    const pool = new DynamicClusterPool(
-      0,
-      max,
-      './tests/worker-files/thread/testWorker.mjs'
-    )
-    expect(pool.starting).toBe(false)
+  it('Verify that a pool with zero worker works', async () => {
     for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) {
-      pool.setWorkerChoiceStrategy(workerChoiceStrategy)
+      const pool = new DynamicClusterPool(
+        0,
+        max,
+        './tests/worker-files/cluster/testWorker.cjs',
+        {
+          workerChoiceStrategy
+        }
+      )
+      expect(pool.starting).toBe(false)
       expect(pool.readyEventEmitted).toBe(false)
       for (let run = 0; run < 2; run++) {
         run % 2 !== 0 && pool.enableTasksQueue(true)
@@ -183,8 +185,8 @@ describe('Dynamic cluster pool test suite', () => {
         expect(pool.readyEventEmitted).toBe(false)
         expect(pool.workerNodes.length).toBe(pool.info.minSize)
       }
+      // We need to clean up the resources after our test
+      await pool.destroy()
     }
-    // We need to clean up the resources after our test
-    await pool.destroy()
   })
 })