X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Futils.test.mjs;h=610b92c3ce62cba912ab9273b14d5cb2077f9884;hb=f4d0a470d13364acc493b877f7e51a3cbb8c29ed;hp=5feb6596296914252a94231e5de19132968a832f;hpb=c3719753af0a9be03abf722a7543495359e817b5;p=poolifier.git diff --git a/tests/pools/utils.test.mjs b/tests/pools/utils.test.mjs index 5feb6596..610b92c3 100644 --- a/tests/pools/utils.test.mjs +++ b/tests/pools/utils.test.mjs @@ -4,14 +4,26 @@ import { expect } from 'expect' import { CircularArray, DEFAULT_CIRCULAR_ARRAY_SIZE -} from '../../lib/circular-array.js' +} from '../../lib/circular-array.cjs' import { createWorker, + getDefaultTasksQueueOptions, updateMeasurementStatistics -} from '../../lib/pools/utils.js' -import { WorkerTypes } from '../../lib/index.js' +} from '../../lib/pools/utils.cjs' +import { WorkerTypes } from '../../lib/index.cjs' describe('Pool utils test suite', () => { + it('Verify getDefaultTasksQueueOptions() behavior', () => { + const poolMaxSize = 4 + expect(getDefaultTasksQueueOptions(poolMaxSize)).toStrictEqual({ + concurrency: 1, + size: Math.pow(poolMaxSize, 2), + taskStealing: true, + tasksStealingOnBackPressure: true, + tasksFinishedTimeout: 2000 + }) + }) + it('Verify updateMeasurementStatistics() behavior', () => { const measurementStatistics = { history: new CircularArray() @@ -103,13 +115,15 @@ describe('Pool utils test suite', () => { expect( createWorker( WorkerTypes.thread, - './tests/worker-files/thread/testWorker.mjs' + './tests/worker-files/thread/testWorker.mjs', + {} ) ).toBeInstanceOf(ThreadWorker) expect( createWorker( WorkerTypes.cluster, - './tests/worker-files/cluster/testWorker.mjs' + './tests/worker-files/cluster/testWorker.mjs', + {} ) ).toBeInstanceOf(ClusterWorker) })