X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fselection-strategies%2Fworker-choice-strategy-context.test.mjs;h=2a5f914e9d89a3bf40828f3ef198482612422a0c;hb=ab2cb6d33349e538dac44f8bf76bf499e5416066;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..2a5f914e 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,16 +96,16 @@ describe('Worker choice strategy context test suite', () => { ) workerChoiceStrategyContext.workerChoiceStrategies.set( workerChoiceStrategyContext.workerChoiceStrategy, - WorkerChoiceStrategyUndefinedStub + workerChoiceStrategyUndefinedStub ) - expect(() => workerChoiceStrategyContext.execute()).toThrowError( + expect(() => workerChoiceStrategyContext.execute()).toThrow( new Error('Worker node key chosen is null or undefined after 6 retries') ) workerChoiceStrategyContext.workerChoiceStrategies.set( workerChoiceStrategyContext.workerChoiceStrategy, - WorkerChoiceStrategyNullStub + workerChoiceStrategyNullStub ) - expect(() => workerChoiceStrategyContext.execute()).toThrowError( + expect(() => workerChoiceStrategyContext.execute()).toThrow( 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(