From: Jérôme Benoit Date: Fri, 7 Apr 2023 11:46:58 +0000 (+0200) Subject: test: ensure the worker choice context class is properly initialized X-Git-Tag: v2.4.3~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2285a040e7d48457c735547e296939b0341d29fd;p=poolifier.git test: ensure the worker choice context class is properly initialized Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js index 2c0250ef..a8f187ee 100644 --- a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js +++ b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js @@ -50,6 +50,15 @@ describe('Worker choice strategy context test suite', () => { await dynamicPool.destroy() }) + it('Verify that constructor() initializes the context with all the available worker choice strategies', () => { + const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( + fixedPool + ) + expect(workerChoiceStrategyContext.workerChoiceStrategies.size).toBe( + Object.keys(WorkerChoiceStrategies).length + ) + }) + it('Verify that execute() return the worker chosen by the strategy with fixed pool', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool