X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Futils.test.mjs;h=5f54f6fc8ea4e0ebe7d7f6ebc27f0efb8a5ea218;hb=f4d0a470d13364acc493b877f7e51a3cbb8c29ed;hp=5e089e291f07877506ff12a3373ca407ee2b5c51;hpb=39618ede0e08d380c1ac82005bcc2ab1f3c227b6;p=poolifier.git diff --git a/tests/utils.test.mjs b/tests/utils.test.mjs index 5e089e29..5f54f6fc 100644 --- a/tests/utils.test.mjs +++ b/tests/utils.test.mjs @@ -244,6 +244,21 @@ describe('Utils test suite', () => { './tests/worker-files/thread/testWorker.mjs' ) expect(getWorkerChoiceStrategyRetries(pool)).toBe(pool.info.maxSize * 2) + const workerChoiceStrategyOptions = { + runTime: { median: true }, + waitTime: { median: true }, + elu: { median: true }, + weights: { + 0: 100, + 1: 100 + } + } + expect( + getWorkerChoiceStrategyRetries(pool, workerChoiceStrategyOptions) + ).toBe( + pool.info.maxSize + + Object.keys(workerChoiceStrategyOptions.weights).length + ) await pool.destroy() }) @@ -262,6 +277,18 @@ describe('Utils test suite', () => { [pool.info.maxSize - 1]: expect.any(Number) }) }) + const workerChoiceStrategyOptions = { + runTime: { median: true }, + waitTime: { median: true }, + elu: { median: true }, + weights: { + 0: 100, + 1: 100 + } + } + expect( + buildWorkerChoiceStrategyOptions(pool, workerChoiceStrategyOptions) + ).toStrictEqual(workerChoiceStrategyOptions) await pool.destroy() })