X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fabstract%2Fabstract-pool.test.js;h=a62caad828a79ab428697eaca2c9b3aa1826fc13;hb=984910dc4377061815ef8cb33a6dc91dfc35be3c;hp=caec34fd47a0ae267f9c6b5dcfe7648a352e1a2a;hpb=2431bdb4c2dc637169bf623a40fc6562f685e56e;p=poolifier.git diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index caec34fd..a62caad8 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -16,13 +16,6 @@ const { waitPoolEvents } = require('../../test-utils') describe('Abstract pool test suite', () => { const numberOfWorkers = 2 - class StubPoolWithRemoveAllWorker extends FixedThreadPool { - removeAllWorker () { - this.workerNodes = [] - this.promiseResponseMap.clear() - this.handleWorkerReadyMessage = () => {} - } - } class StubPoolWithIsMain extends FixedThreadPool { isMain () { return false @@ -82,7 +75,7 @@ describe('Abstract pool test suite', () => { ) }) - it('Verify dynamic pool sizing', () => { + it('Verify that dynamic pool sizing is checked', () => { expect( () => new DynamicThreadPool(2, 1, './tests/worker-files/thread/testWorker.js') @@ -99,6 +92,14 @@ describe('Abstract pool test suite', () => { 'Cannot instantiate a dynamic pool with a minimum pool size equal to the maximum pool size. Use a fixed pool instead' ) ) + expect( + () => + new DynamicThreadPool(0, 0, './tests/worker-files/thread/testWorker.js') + ).toThrowError( + new RangeError( + 'Cannot instantiate a dynamic pool with a minimum pool size and a maximum pool size equal to zero' + ) + ) }) it('Verify that pool options are checked', async () => { @@ -457,21 +458,6 @@ describe('Abstract pool test suite', () => { await pool.destroy() }) - it('Simulate worker not found', async () => { - const pool = new StubPoolWithRemoveAllWorker( - numberOfWorkers, - './tests/worker-files/thread/testWorker.js', - { - errorHandler: e => console.error(e) - } - ) - expect(pool.workerNodes.length).toBe(numberOfWorkers) - // Simulate worker not found. - pool.removeAllWorker() - expect(pool.workerNodes.length).toBe(0) - await pool.destroy() - }) - it('Verify that pool worker tasks usage are initialized', async () => { const pool = new FixedClusterPool( numberOfWorkers,