Report more cleanups from work in progress PRs
[poolifier.git] / tests / pools / thread / dynamic.test.js
index 3ae35ac937f2adcdf6ff2f1f4baf83f70dd35548..92fbd9b8f9e128382c5781f45719db104bebb19f 100644 (file)
@@ -51,14 +51,10 @@ describe('Dynamic thread pool test suite', () => {
   })
 
   it('Shutdown test', async () => {
-    let closedThreads = 0
-    pool.workers.forEach(w => {
-      w.on('exit', () => {
-        closedThreads++
-      })
-    })
+    const exitPromise = TestUtils.waitExits(pool, min)
     await pool.destroy()
-    expect(closedThreads).toBe(min)
+    const numberOfExitEvents = await exitPromise
+    expect(numberOfExitEvents).toBe(min)
   })
 
   it('Validation of inputs test', () => {