const { expect } = require('expect')
const { DynamicThreadPool, PoolEvents } = require('../../../lib')
-const { WorkerFunctions } = require('../../test-types')
+const { TaskFunctions } = require('../../test-types')
const { sleep, waitWorkerEvents } = require('../../test-utils')
describe('Dynamic thread pool test suite', () => {
max,
'./tests/worker-files/thread/testWorker.js',
{
- errorHandler: e => console.error(e)
+ errorHandler: (e) => console.error(e)
}
)
it('Verify that the function is executed in a worker thread', async () => {
let result = await pool.execute({
- function: WorkerFunctions.fibonacci
+ function: TaskFunctions.fibonacci
})
expect(result).toBe(75025)
result = await pool.execute({
- function: WorkerFunctions.factorial
+ function: TaskFunctions.factorial
})
expect(result).toBe(9.33262154439441e157)
})
max,
'./tests/worker-files/thread/longRunningWorkerHardBehavior.js',
{
- errorHandler: e => console.error(e),
+ errorHandler: (e) => console.error(e),
onlineHandler: () => console.info('long executing worker is online'),
exitHandler: () => console.info('long executing worker exited')
}
max,
'./tests/worker-files/thread/longRunningWorkerSoftBehavior.js',
{
- errorHandler: e => console.error(e),
+ errorHandler: (e) => console.error(e),
onlineHandler: () => console.info('long executing worker is online'),
exitHandler: () => console.info('long executing worker exited')
}