Fix pool execute promises fullfilment in tests
[poolifier.git] / tests / pools / cluster / dynamic.test.js
index 61e1d6e2cd131bc8dabf95265854ec244bfdaa94..9e4a6b235134408f83537dec6a60652acdb52a58 100644 (file)
@@ -26,6 +26,7 @@ describe('Dynamic cluster 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.