X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fthread%2Fdynamic.test.js;h=94320429ce6d2cfa9deb956bcfac39f996ab26b9;hb=40ad1d27cb93fc21c700ed6ba96711104fd320c6;hp=92fbd9b8f9e128382c5781f45719db104bebb19f;hpb=cf597bc58029b9b5bf861c29fa9e917a6a72d859;p=poolifier.git diff --git a/tests/pools/thread/dynamic.test.js b/tests/pools/thread/dynamic.test.js index 92fbd9b8..94320429 100644 --- a/tests/pools/thread/dynamic.test.js +++ b/tests/pools/thread/dynamic.test.js @@ -26,7 +26,8 @@ describe('Dynamic thread pool test suite', () => { for (let i = 0; i < max * 2; i++) { promises.push(pool.execute({ test: 'test' })) } - expect(pool.workers.length).toBe(max) + expect(pool.workers.length).toBeLessThanOrEqual(max) + expect(pool.workers.length).toBeGreaterThan(min) // The `busy` event is triggered when the number of submitted tasks at once reach the max number of workers in the dynamic pool. // So in total numberOfWorkers + 1 times for a loop submitting up to numberOfWorkers * 2 tasks to the dynamic pool. expect(poolBusy).toBe(max + 1)