const { expect } = require('expect')
// const sinon = require('sinon')
const {
- SelectionStrategiesUtils
+ getWorkerChoiceStrategy
} = require('../../../lib/pools/selection-strategies/selection-strategies-utils')
const {
FixedThreadPool,
})
it('Verify that getWorkerChoiceStrategy() default return ROUND_ROBIN strategy', () => {
- const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(pool)
+ const strategy = getWorkerChoiceStrategy(pool)
expect(strategy).toBeInstanceOf(RoundRobinWorkerChoiceStrategy)
})
it('Verify that getWorkerChoiceStrategy() can return ROUND_ROBIN strategy', () => {
- const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(
+ const strategy = getWorkerChoiceStrategy(
pool,
WorkerChoiceStrategies.ROUND_ROBIN
)
})
it('Verify that getWorkerChoiceStrategy() can return LESS_RECENTLY_USED strategy', () => {
- const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(
+ const strategy = getWorkerChoiceStrategy(
pool,
WorkerChoiceStrategies.LESS_RECENTLY_USED
)
})
it('Verify that getWorkerChoiceStrategy() can return FAIR_SHARE strategy', () => {
- const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(
+ const strategy = getWorkerChoiceStrategy(
pool,
WorkerChoiceStrategies.FAIR_SHARE
)
})
it('Verify that getWorkerChoiceStrategy() can return WEIGHTED_ROUND_ROBIN strategy', () => {
- const strategy = SelectionStrategiesUtils.getWorkerChoiceStrategy(
+ const strategy = getWorkerChoiceStrategy(
pool,
WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
)
it('Verify that getWorkerChoiceStrategy() throw error on unknown strategy', () => {
expect(() => {
- SelectionStrategiesUtils.getWorkerChoiceStrategy(pool, 'UNKNOWN_STRATEGY')
+ getWorkerChoiceStrategy(pool, 'UNKNOWN_STRATEGY')
}).toThrowError(
new Error("Worker choice strategy 'UNKNOWN_STRATEGY' not found")
)