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=3f94411c98c104b5ee82697e134c31f557886ccf;hb=644992db7bd22ca02c9610f7d622d7973f861d0b;hp=cc3e66a49e752b349e4ae8153facbddfadca81ac;hpb=ffcbbad84f63b8a77f2b1a08f82deef5430f646e;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 cc3e66a4..3f94411c 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,6 +1,6 @@ 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') @@ -25,17 +25,17 @@ 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() - const initWorkersTaskRunTimeStub = sinon - .stub(strategy, 'initWorkersTaskRunTime') - .returns() + strategy.currentWorkerId = TestUtils.generateRandomInteger( + Number.MAX_SAFE_INTEGER, + 1 + ) + strategy.workerVirtualTaskRunTime = TestUtils.generateRandomInteger( + Number.MAX_SAFE_INTEGER, + 1 + ) const resetResult = strategy.reset() expect(resetResult).toBe(true) - expect(strategy.currentWorkerId).toBe(0) - expect(workersTaskRunTimeClearStub.calledOnce).toBe(true) - expect(initWorkersTaskRunTimeStub.calledOnce).toBe(true) + expect(strategy.currentWorkerNodeId).toBe(0) + expect(strategy.workerVirtualTaskRunTime).toBe(0) }) })