X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fselection-strategies%2Fweighted-round-robin-worker-choice-strategy.test.js;h=8e59d81e192d89f5d51dfbab18fdc62be3b5827c;hb=82888165d01dba6a57f5047d4a4c27c6da6025f3;hp=24246595e6bdc92bcd40afad6638c31ef3842e83;hpb=6cdd998caa931ce15a2c59f7e616e0611573ec72;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 24246595..8e59d81e 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 @@ -1,9 +1,10 @@ const { expect } = require('expect') const sinon = require('sinon') -const { FixedThreadPool } = require('../../../lib/index') +const { FixedThreadPool } = require('../../../lib') 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 @@ -24,6 +25,7 @@ describe('Weighted round robin strategy worker choice strategy test suite', () = 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.currentWorkerNodeId).toBe(0) expect(workersTaskRunTimeClearStub.calledOnce).toBe(true) expect(initWorkersTaskRunTimeStub.calledOnce).toBe(true) })