sinon.restore()
})
- after(() => {
- fixedPool.destroy()
- dynamicPool.destroy()
+ after(async () => {
+ await fixedPool.destroy()
+ await dynamicPool.destroy()
})
it('Verify that execute() return the worker chosen by the strategy with fixed pool', () => {
}
)
workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub
- const worker = workerChoiceStrategyContext.execute()
+ const chosenWorker = workerChoiceStrategyContext.execute()
expect(
- workerChoiceStrategyContext.workerChoiceStrategy.choose.calledOnce
+ workerChoiceStrategyContext.getWorkerChoiceStrategy().choose.calledOnce
).toBe(true)
- expect(worker).toBe('worker')
+ expect(chosenWorker).toBe('worker')
})
it('Verify that execute() return the worker chosen by the strategy with dynamic pool', () => {
}
)
workerChoiceStrategyContext.workerChoiceStrategy = WorkerChoiceStrategyStub
- const worker = workerChoiceStrategyContext.execute()
+ const chosenWorker = workerChoiceStrategyContext.execute()
expect(
- workerChoiceStrategyContext.workerChoiceStrategy.choose.calledOnce
+ workerChoiceStrategyContext.getWorkerChoiceStrategy().choose.calledOnce
).toBe(true)
- expect(worker).toBe('worker')
+ expect(chosenWorker).toBe('worker')
})
it('Verify that setWorkerChoiceStrategy() works with ROUND_ROBIN and fixed pool', () => {