Fix pool execute promises fullfilment in tests
[poolifier.git] / tests / pools / cluster / fixed.test.js
index 2ef709c1d0fc71fa3d6da9af508d8afa3859d5cf..52ba58d7114cd78f89b4d46f8f5b7b8c992d5501 100644 (file)
@@ -74,6 +74,7 @@ describe('Fixed cluster pool test suite', () => {
     for (let i = 0; i < numberOfWorkers * 2; i++) {
       promises.push(pool.execute({ test: 'test' }))
     }
+    await Promise.all(promises)
     // The `busy` event is triggered when the number of submitted tasks at once reach the number of fixed pool workers.
     // So in total numberOfWorkers + 1 times for a loop submitting up to numberOfWorkers * 2 tasks to the fixed pool.
     expect(poolBusy).toBe(numberOfWorkers + 1)