Merge dependabot/npm_and_yarn/examples/typescript/http-client-pool/poolifier-3.1...
[poolifier.git] / tests / pools / thread / dynamic.test.mjs
index c31e141c091b52c7ff2050253051eb8fd2e68092..f7329710bd3c90e2264bebed7ab7aa628c0bccae 100644 (file)
@@ -37,10 +37,10 @@ describe('Dynamic thread pool test suite', () => {
     expect(poolBusy).toBe(1)
     const numberOfExitEvents = await waitWorkerEvents(pool, 'exit', max - min)
     expect(numberOfExitEvents).toBe(max - min)
+    expect(pool.workerNodes.length).toBe(min)
   })
 
   it('Verify scale thread up and down is working', async () => {
-    expect(pool.workerNodes.length).toBe(min)
     for (let i = 0; i < max * 2; i++) {
       pool.execute()
     }
@@ -67,14 +67,16 @@ describe('Dynamic thread pool test suite', () => {
     await pool.destroy()
     const numberOfExitEvents = await exitPromise
     expect(pool.started).toBe(false)
+    expect(pool.emitter.eventNames()).toStrictEqual([])
+    expect(pool.readyEventEmitted).toBe(false)
     expect(pool.workerNodes.length).toBe(0)
     expect(numberOfExitEvents).toBe(min)
     expect(poolDestroy).toBe(1)
   })
 
   it('Validation of inputs test', () => {
-    expect(() => new DynamicThreadPool(min)).toThrowError(
-      "Cannot find the worker file 'undefined'"
+    expect(() => new DynamicThreadPool(min)).toThrow(
+      'The worker file path must be specified'
     )
   })