fix: ensure worker node cannot be instantiaed without proper arguments
[poolifier.git] / tests / pools / thread / dynamic.test.js
index ac926a927a2c22f11a8b82c95785c8658210cfe5..f85d44ff4c42c6343ac49efa9cb73441c06b9e5f 100644 (file)
@@ -11,7 +11,7 @@ describe('Dynamic thread pool test suite', () => {
     max,
     './tests/worker-files/thread/testWorker.js',
     {
-      errorHandler: e => console.error(e)
+      errorHandler: (e) => console.error(e)
     }
   )
 
@@ -59,9 +59,12 @@ describe('Dynamic thread pool test suite', () => {
 
   it('Shutdown test', async () => {
     const exitPromise = waitWorkerEvents(pool, 'exit', min)
+    let poolDestroy = 0
+    pool.emitter.on(PoolEvents.destroy, () => ++poolDestroy)
     await pool.destroy()
     const numberOfExitEvents = await exitPromise
     expect(numberOfExitEvents).toBe(min)
+    expect(poolDestroy).toBe(1)
   })
 
   it('Validation of inputs test', () => {
@@ -88,7 +91,7 @@ describe('Dynamic thread pool test suite', () => {
       max,
       './tests/worker-files/thread/longRunningWorkerHardBehavior.js',
       {
-        errorHandler: e => console.error(e),
+        errorHandler: (e) => console.error(e),
         onlineHandler: () => console.info('long executing worker is online'),
         exitHandler: () => console.info('long executing worker exited')
       }
@@ -115,7 +118,7 @@ describe('Dynamic thread pool test suite', () => {
       max,
       './tests/worker-files/thread/longRunningWorkerSoftBehavior.js',
       {
-        errorHandler: e => console.error(e),
+        errorHandler: (e) => console.error(e),
         onlineHandler: () => console.info('long executing worker is online'),
         exitHandler: () => console.info('long executing worker exited')
       }