X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fabstract%2Fabstract-pool.test.js;h=a2170491243313c13c65c36f8222eb5324e19eb9;hb=e843b9042b77e0e4e17c193820a3e05ffc92cffe;hp=4eccde68f94faa99fab805426679bdc4f916e952;hpb=292ad316a2815762f2e4a822383f1aef5ae49774;p=poolifier.git diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index 4eccde68..a2170491 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -1,5 +1,9 @@ const expect = require('expect') -const { FixedClusterPool, FixedThreadPool } = require('../../../lib/index') +const { + FixedClusterPool, + FixedThreadPool, + WorkerChoiceStrategies +} = require('../../../lib/index') const expectedError = new Error('Worker could not be found in tasks map') const numberOfWorkers = 1 @@ -102,16 +106,23 @@ describe('Abstract pool test suite', () => { ) expect(pool.opts.enableEvents).toEqual(true) expect(pool.emitter).toBeDefined() + expect(pool.opts.workerChoiceStrategy).toBe( + WorkerChoiceStrategies.ROUND_ROBIN + ) pool.destroy() pool = new FixedThreadPool( numberOfWorkers, './tests/worker-files/thread/testWorker.js', { + workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED, enableEvents: false } ) expect(pool.opts.enableEvents).toEqual(false) expect(pool.emitter).toBeUndefined() + expect(pool.opts.workerChoiceStrategy).toBe( + WorkerChoiceStrategies.LESS_RECENTLY_USED + ) pool.destroy() })