Fix pool execute promises fullfilment in tests
[poolifier.git] / tests / pools / thread / fixed.test.js
index 785c6e5d2d01c8801c0e34e1d33bc292bd543347..f89977b3a5be536f71972c2db66e2837eac4f3b4 100644 (file)
@@ -74,6 +74,7 @@ describe('Fixed thread pool test suite', () => {
     for (let i = 0; i < numberOfThreads * 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 numberOfThreads + 1 times for a loop submitting up to numberOfThreads * 2 tasks to the fixed pool.
     expect(poolBusy).toBe(numberOfThreads + 1)