Report more cleanups from work in progress PRs
[poolifier.git] / tests / pools / abstract / abstract-pool.test.js
index d4690b4fac4dcc5e9233b1a773ba4adb178f8b4b..d9ab30fec9d0a9f11629fcf69ca4b0921469fdb9 100644 (file)
@@ -139,7 +139,7 @@ describe('Abstract pool test suite', () => {
     pool.destroy()
   })
 
-  it("Verify that pool event emitter 'busy' event can register a callback", () => {
+  it("Verify that pool event emitter 'busy' event can register a callback", async () => {
     const pool = new FixedThreadPool(
       numberOfWorkers,
       './tests/worker-files/thread/testWorker.js'
@@ -150,6 +150,7 @@ describe('Abstract 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)