X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=tests%2Fpools%2Fselection-strategies%2Fweighted-round-robin-worker-choice-strategy.test.js;h=cc3e66a49e752b349e4ae8153facbddfadca81ac;hb=ffcbbad84f63b8a77f2b1a08f82deef5430f646e;hp=664a447a1e829fc902842f0cc03966006d513540;hpb=0220f124adb20bbaebb927962b9346daa95a1d96;p=poolifier.git diff --git a/tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.js b/tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.js index 664a447a..cc3e66a4 100644 --- a/tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.js +++ b/tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.js @@ -4,6 +4,7 @@ const { FixedThreadPool } = require('../../../lib/index') const { WeightedRoundRobinWorkerChoiceStrategy } = require('../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy') +const TestUtils = require('../../test-utils') describe('Weighted round robin strategy worker choice strategy test suite', () => { // const min = 1 @@ -22,8 +23,9 @@ describe('Weighted round robin strategy worker choice strategy test suite', () = await pool.destroy() }) - it.only('Verify that reset() resets internals', () => { + it('Verify that reset() resets internals', () => { const strategy = new WeightedRoundRobinWorkerChoiceStrategy(pool) + strategy.currentWorkerId = TestUtils.generateRandomInteger() const workersTaskRunTimeClearStub = sinon .stub(strategy.workersTaskRunTime, 'clear') .returns() @@ -32,9 +34,7 @@ describe('Weighted round robin strategy worker choice strategy test suite', () = .returns() const resetResult = strategy.reset() expect(resetResult).toBe(true) - expect(strategy.previousWorkerIndex).toBe(0) - expect(strategy.currentWorkerIndex).toBe(0) - expect(strategy.defaultWorkerWeight).toBeGreaterThan(0) + expect(strategy.currentWorkerId).toBe(0) expect(workersTaskRunTimeClearStub.calledOnce).toBe(true) expect(initWorkersTaskRunTimeStub.calledOnce).toBe(true) })