X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fpools%2Fselection-strategies%2Fworker-choice-strategy-context.test.js;h=9ab2babfd31ce26fa6286338ced68d2e4f2ae7ea;hb=c923ce5670eeae4194aa996d44a1071e88cb21ad;hp=9380a038800abcb246c532240717940fe735e79f;hpb=168c526f6e6913506e56f7d5107335c3d3d42938;p=poolifier.git 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 9380a038..9ab2babf 100644 --- a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js +++ b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js @@ -60,15 +60,15 @@ describe('Worker choice strategy context test suite', () => { const WorkerChoiceStrategyStub = sinon.createStubInstance( RoundRobinWorkerChoiceStrategy, { - choose: sinon.stub().returns('worker') + choose: sinon.stub().returns(0) } ) workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub - const chosenWorker = workerChoiceStrategyContext.execute() + const chosenWorkerKey = workerChoiceStrategyContext.execute() expect( workerChoiceStrategyContext.getWorkerChoiceStrategy().choose.calledOnce ).toBe(true) - expect(chosenWorker).toBe('worker') + expect(chosenWorkerKey).toBe(0) }) it('Verify that execute() return the worker chosen by the strategy with dynamic pool', () => { @@ -78,15 +78,15 @@ describe('Worker choice strategy context test suite', () => { const WorkerChoiceStrategyStub = sinon.createStubInstance( RoundRobinWorkerChoiceStrategy, { - choose: sinon.stub().returns('worker') + choose: sinon.stub().returns(0) } ) workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub - const chosenWorker = workerChoiceStrategyContext.execute() + const chosenWorkerKey = workerChoiceStrategyContext.execute() expect( workerChoiceStrategyContext.getWorkerChoiceStrategy().choose.calledOnce ).toBe(true) - expect(chosenWorker).toBe('worker') + expect(chosenWorkerKey).toBe(0) }) it('Verify that setWorkerChoiceStrategy() works with ROUND_ROBIN and fixed pool', () => {