X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fselection-strategies%2Fworker-choice-strategy-context.test.mjs;h=dc898e4ff04cd8ccb554a1215191896354757928;hb=ae04560e0cdbf750bac433a691bfee1b0f5f54e1;hp=f9b1c8d590ac39e9d8657bc9348456483808af0a;hpb=a074ffee1b46f43d0dcfba58128748c7492104dd;p=poolifier.git diff --git a/tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs b/tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs index f9b1c8d5..dc898e4f 100644 --- a/tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs +++ b/tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs @@ -22,12 +22,12 @@ describe('Worker choice strategy context test suite', () => { before(() => { fixedPool = new FixedThreadPool( max, - './tests/worker-files/thread/testWorker.js' + './tests/worker-files/thread/testWorker.mjs' ) dynamicPool = new DynamicThreadPool( min, max, - './tests/worker-files/thread/testWorker.js' + './tests/worker-files/thread/testWorker.mjs' ) }) @@ -53,7 +53,7 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) - const WorkerChoiceStrategyStub = createStubInstance( + const workerChoiceStrategyStub = createStubInstance( RoundRobinWorkerChoiceStrategy, { choose: stub().returns(0) @@ -64,7 +64,7 @@ describe('Worker choice strategy context test suite', () => { ) workerChoiceStrategyContext.workerChoiceStrategies.set( workerChoiceStrategyContext.workerChoiceStrategy, - WorkerChoiceStrategyStub + workerChoiceStrategyStub ) const chosenWorkerKey = workerChoiceStrategyContext.execute() expect( @@ -79,13 +79,13 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) - const WorkerChoiceStrategyUndefinedStub = createStubInstance( + const workerChoiceStrategyUndefinedStub = createStubInstance( RoundRobinWorkerChoiceStrategy, { choose: stub().returns(undefined) } ) - const WorkerChoiceStrategyNullStub = createStubInstance( + const workerChoiceStrategyNullStub = createStubInstance( RoundRobinWorkerChoiceStrategy, { choose: stub().returns(null) @@ -96,14 +96,14 @@ describe('Worker choice strategy context test suite', () => { ) workerChoiceStrategyContext.workerChoiceStrategies.set( workerChoiceStrategyContext.workerChoiceStrategy, - WorkerChoiceStrategyUndefinedStub + workerChoiceStrategyUndefinedStub ) expect(() => workerChoiceStrategyContext.execute()).toThrowError( new Error('Worker node key chosen is null or undefined after 6 retries') ) workerChoiceStrategyContext.workerChoiceStrategies.set( workerChoiceStrategyContext.workerChoiceStrategy, - WorkerChoiceStrategyNullStub + workerChoiceStrategyNullStub ) expect(() => workerChoiceStrategyContext.execute()).toThrowError( new Error('Worker node key chosen is null or undefined after 6 retries') @@ -114,7 +114,7 @@ describe('Worker choice strategy context test suite', () => { const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) - const WorkerChoiceStrategyStub = createStubInstance( + const workerChoiceStrategyStub = createStubInstance( RoundRobinWorkerChoiceStrategy, { choose: stub().returns(0) @@ -125,7 +125,7 @@ describe('Worker choice strategy context test suite', () => { ) workerChoiceStrategyContext.workerChoiceStrategies.set( workerChoiceStrategyContext.workerChoiceStrategy, - WorkerChoiceStrategyStub + workerChoiceStrategyStub ) const chosenWorkerKey = workerChoiceStrategyContext.execute() expect(