Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
})
it("Verify that 'busy' event is emitted", async () => {
- expect(pool.emitter.eventNames()).toStrictEqual([])
const promises = new Set()
+ expect(pool.emitter.eventNames()).toStrictEqual([])
let poolBusy = 0
pool.emitter.on(PoolEvents.busy, () => ++poolBusy)
expect(pool.emitter.eventNames()).toStrictEqual([PoolEvents.busy])
it('Shutdown test', async () => {
const exitPromise = waitWorkerEvents(pool, 'exit', numberOfThreads)
+ expect(pool.emitter.eventNames()).toStrictEqual([PoolEvents.busy])
let poolDestroy = 0
pool.emitter.on(PoolEvents.destroy, () => ++poolDestroy)
+ expect(pool.emitter.eventNames()).toStrictEqual([
+ PoolEvents.busy,
+ PoolEvents.destroy
+ ])
await pool.destroy()
const numberOfExitEvents = await exitPromise
expect(pool.started).toBe(false)