- it('Verify that execute() throws error if worker choice strategy recursion reach the maximum depth', () => {
- const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
- fixedPool
- )
- const workerChoiceStrategyStub = createStubInstance(
- RoundRobinWorkerChoiceStrategy,
- {
- hasPoolWorkerNodesReady: stub().returns(false),
- choose: stub().returns(0)
- }
- )
- expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe(
- WorkerChoiceStrategies.ROUND_ROBIN
- )
- workerChoiceStrategyContext.workerChoiceStrategies.set(
- workerChoiceStrategyContext.workerChoiceStrategy,
- workerChoiceStrategyStub
- )
- expect(() => workerChoiceStrategyContext.execute()).toThrow(
- new RangeError('Maximum call stack size exceeded')
- )
- })
-