X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fselection-strategies%2Fweighted-round-robin-worker-choice-strategy.test.mjs;h=95f1397e6aafbd15ef66a6327fb3c0ab0ef9c75d;hb=3bcbd4c5be5678988281342a1fc1f6a62f9c77d7;hp=25c262fde5ea946a1a1de8b2a18ca8417636a02d;hpb=cd424e3162f5ae6be04dc156cdc8562dae16c33f;p=poolifier.git diff --git a/tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.mjs b/tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.mjs index 25c262fd..95f1397e 100644 --- a/tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.mjs +++ b/tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.mjs @@ -1,7 +1,7 @@ +import { randomInt } from 'node:crypto' import { expect } from 'expect' -import { FixedThreadPool } from '../../../lib/index.js' -import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.js' -import { generateRandomInteger } from '../../test-utils.js' +import { FixedThreadPool } from '../../../lib/index.cjs' +import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.cjs' describe('Weighted round robin strategy worker choice strategy test suite', () => { // const min = 1 @@ -21,11 +21,8 @@ describe('Weighted round robin strategy worker choice strategy test suite', () = it('Verify that reset() resets internals', () => { const strategy = new WeightedRoundRobinWorkerChoiceStrategy(pool) - strategy.currentWorkerId = generateRandomInteger(Number.MAX_SAFE_INTEGER, 1) - strategy.workerVirtualTaskRunTime = generateRandomInteger( - Number.MAX_SAFE_INTEGER, - 1 - ) + strategy.currentWorkerId = randomInt(281474976710655) + strategy.workerVirtualTaskRunTime = randomInt(281474976710655) expect(strategy.reset()).toBe(true) expect(strategy.nextWorkerNodeKey).toBe(0) expect(strategy.previousWorkerNodeKey).toBe(0)