let result = await pool.execute({
function: WorkerFunctions.fibonacci
})
- expect(result).toBe(false)
+ expect(result).toBe(121393)
result = await pool.execute({
function: WorkerFunctions.factorial
})
- expect(result).toBe(false)
+ expect(result).toBe(9.33262154439441e157)
})
it('Verify that is possible to invoke the execute() method without input', async () => {
expect(inError).toBeDefined()
expect(typeof inError === 'string').toBe(true)
expect(inError).toBe('Error Message from ClusterWorker')
+ expect(
+ errorPool.workerNodes.some(
+ workerNode => workerNode.tasksUsage.error === 1
+ )
+ ).toBe(true)
})
it('Verify that error handling is working properly:async', async () => {
expect(inError).toBeDefined()
expect(typeof inError === 'string').toBe(true)
expect(inError).toBe('Error Message from ClusterWorker:async')
+ expect(
+ asyncErrorPool.workerNodes.some(
+ workerNode => workerNode.tasksUsage.error === 1
+ )
+ ).toBe(true)
})
it('Verify that async function is working properly', async () => {