From: Jérôme Benoit Date: Wed, 13 Dec 2023 13:44:57 +0000 (+0100) Subject: test: code cleanup X-Git-Tag: v3.1.0~11 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6ff68506534dde3c585fd6a6abb299744f7002ca;p=poolifier.git test: code cleanup Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs b/tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs index a5447b73..bb8c7fef 100644 --- a/tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs +++ b/tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs @@ -80,6 +80,9 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) + expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( + WorkerChoiceStrategies.ROUND_ROBIN + ) const workerChoiceStrategyUndefinedStub = createStubInstance( RoundRobinWorkerChoiceStrategy, { @@ -87,16 +90,6 @@ describe('Worker choice strategy context test suite', () => { choose: stub().returns(undefined) } ) - const workerChoiceStrategyNullStub = createStubInstance( - RoundRobinWorkerChoiceStrategy, - { - hasPoolWorkerNodesReady: stub().returns(true), - choose: stub().returns(null) - } - ) - expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( - WorkerChoiceStrategies.ROUND_ROBIN - ) workerChoiceStrategyContext.workerChoiceStrategies.set( workerChoiceStrategyContext.workerChoiceStrategy, workerChoiceStrategyUndefinedStub @@ -104,6 +97,13 @@ describe('Worker choice strategy context test suite', () => { expect(() => workerChoiceStrategyContext.execute()).toThrow( new Error('Worker node key chosen is null or undefined after 6 retries') ) + const workerChoiceStrategyNullStub = createStubInstance( + RoundRobinWorkerChoiceStrategy, + { + hasPoolWorkerNodesReady: stub().returns(true), + choose: stub().returns(null) + } + ) workerChoiceStrategyContext.workerChoiceStrategies.set( workerChoiceStrategyContext.workerChoiceStrategy, workerChoiceStrategyNullStub