const min = 1
const max = 3
const pool = new DynamicThreadPool(min, max,
- './tests/testWorker.js',
+ './tests/workers/testWorker.js',
{ errorHandler: (e) => console.error(e), onlineHandler: () => console.log('worker is online') })
describe('Dynamic thread pool test suite ', () => {
closedThreads++
})
})
- pool.destroy()
- await new Promise(resolve => setTimeout(resolve, 2000))
+ await pool.destroy()
expect(closedThreads).toBe(min)
})
})
it('Should work even without opts in input', async () => {
- const pool1 = new DynamicThreadPool(1, 1, './tests/testWorker.js')
+ const pool1 = new DynamicThreadPool(1, 1, './tests/workers/testWorker.js')
const res = await pool1.execute({ test: 'test' })
expect(res).toBeFalsy()
})