import { expect } from 'expect'
+
import {
DynamicThreadPool,
PoolEvents,
let result = await pool.execute({
function: TaskFunctions.fibonacci
})
- expect(result).toBe(75025)
+ expect(result).toBe(354224848179262000000)
result = await pool.execute({
function: TaskFunctions.factorial
})
await pool.destroy()
const numberOfExitEvents = await exitPromise
expect(pool.started).toBe(false)
- expect(pool.emitter.eventNames()).toStrictEqual([])
+ expect(pool.emitter.eventNames()).toStrictEqual([
+ PoolEvents.busy,
+ PoolEvents.destroy
+ ])
expect(pool.readyEventEmitted).toBe(false)
expect(pool.workerNodes.length).toBe(0)
expect(numberOfExitEvents).toBe(min)
await waitWorkerEvents(longRunningPool, 'exit', max - min)
expect(longRunningPool.workerNodes.length).toBe(min)
expect(
- longRunningPool.workerChoiceStrategyContext.workerChoiceStrategies.get(
- longRunningPool.workerChoiceStrategyContext.workerChoiceStrategy
+ longRunningPool.workerChoiceStrategiesContext.workerChoiceStrategies.get(
+ longRunningPool.workerChoiceStrategiesContext
+ .defaultWorkerChoiceStrategy
).nextWorkerNodeKey
).toBeLessThan(longRunningPool.workerNodes.length)
// We need to clean up the resources after our test