Apply dependencies update (#381)
[poolifier.git] / tests / pools / thread / fixed.test.js
index 09a58e2df5cafd27569842ae945373ea1a5b017f..6030866fb70181e0c229baa3a7bbacebc570eeea 100644 (file)
@@ -74,7 +74,9 @@ describe('Fixed thread pool test suite', () => {
     for (let i = 0; i < numberOfThreads * 2; i++) {
       promises.push(pool.execute({ test: 'test' }))
     }
-    expect(poolBusy).toEqual(numberOfThreads)
+    // The `busy` event is triggered when the number of submitted tasks at once reach the number of fixed pool workers.
+    // So in total numberOfThreads + 1 times for a loop submitting up to numberOfThreads * 2 tasks to the fixed pool.
+    expect(poolBusy).toBe(numberOfThreads + 1)
   })
 
   it('Verify that is possible to have a worker that return undefined', async () => {
@@ -100,7 +102,7 @@ describe('Fixed thread pool test suite', () => {
     expect(inError).toBeDefined()
     expect(inError).toBeInstanceOf(Error)
     expect(inError.message).toBeDefined()
-    expect(typeof inError.message === 'string').toEqual(true)
+    expect(typeof inError.message === 'string').toBe(true)
   })
 
   it('Verify that error handling is working properly:async', async () => {
@@ -114,7 +116,7 @@ describe('Fixed thread pool test suite', () => {
     expect(inError).toBeDefined()
     expect(inError).toBeInstanceOf(Error)
     expect(inError.message).toBeDefined()
-    expect(typeof inError.message === 'string').toEqual(true)
+    expect(typeof inError.message === 'string').toBe(true)
   })
 
   it('Verify that async function is working properly', async () => {