+ expect(
+ workerChoiceStrategyContext.getWorkerChoiceStrategy()
+ ).toBeInstanceOf(FairShareWorkerChoiceStrategy)
+ })
+
+ it('Verify that setWorkerChoiceStrategy() works with FAIR_SHARE and dynamic pool', () => {
+ const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
+ dynamicPool
+ )
+ workerChoiceStrategyContext.setWorkerChoiceStrategy(
+ WorkerChoiceStrategies.FAIR_SHARE
+ )
+ expect(
+ workerChoiceStrategyContext.getWorkerChoiceStrategy()
+ ).toBeInstanceOf(DynamicPoolWorkerChoiceStrategy)
+ expect(
+ workerChoiceStrategyContext.getWorkerChoiceStrategy().workerChoiceStrategy
+ ).toBeInstanceOf(FairShareWorkerChoiceStrategy)
+ })
+
+ it('Verify that setWorkerChoiceStrategy() works with WEIGHTED_ROUND_ROBIN and fixed pool', () => {
+ const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
+ fixedPool
+ )
+ workerChoiceStrategyContext.setWorkerChoiceStrategy(
+ WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
+ )
+ expect(
+ workerChoiceStrategyContext.getWorkerChoiceStrategy()
+ ).toBeInstanceOf(WeightedRoundRobinWorkerChoiceStrategy)
+ })
+
+ it('Verify that setWorkerChoiceStrategy() works with WEIGHTED_ROUND_ROBIN and dynamic pool', () => {
+ const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
+ dynamicPool
+ )
+ workerChoiceStrategyContext.setWorkerChoiceStrategy(
+ WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
+ )
+ expect(
+ workerChoiceStrategyContext.getWorkerChoiceStrategy()
+ ).toBeInstanceOf(DynamicPoolWorkerChoiceStrategy)
+ expect(
+ workerChoiceStrategyContext.getWorkerChoiceStrategy().workerChoiceStrategy
+ ).toBeInstanceOf(WeightedRoundRobinWorkerChoiceStrategy)