Fix pool execute promises fullfilment in tests
[poolifier.git] / tests / pools / thread / dynamic.test.js
index 94320429ce6d2cfa9deb956bcfac39f996ab26b9..f345a0ee665a78543e085bad4dd32248c70bd7d7 100644 (file)
@@ -26,6 +26,7 @@ describe('Dynamic thread pool test suite', () => {
     for (let i = 0; i < max * 2; i++) {
       promises.push(pool.execute({ test: 'test' }))
     }
+    await Promise.all(promises)
     expect(pool.workers.length).toBeLessThanOrEqual(max)
     expect(pool.workers.length).toBeGreaterThan(min)
     // The `busy` event is triggered when the number of submitted tasks at once reach the max number of workers in the dynamic pool.