X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fpools%2Fthread%2Ffixed.test.js;h=45197cbade4f5492ea2e2c5933f7a5294bea9bad;hb=bac873bd6581e5d5c0884bc520e9ec3c446509e6;hp=8a0cfeadcbd4660b63e604d5214674d4328f8adb;hpb=bb4e9c3d36509745767905e4577d000087a23288;p=poolifier.git diff --git a/tests/pools/thread/fixed.test.js b/tests/pools/thread/fixed.test.js index 8a0cfead..45197cba 100644 --- a/tests/pools/thread/fixed.test.js +++ b/tests/pools/thread/fixed.test.js @@ -1,7 +1,7 @@ const { expect } = require('expect') const { FixedThreadPool, PoolEvents } = require('../../../lib') const { WorkerFunctions } = require('../../test-types') -const TestUtils = require('../../test-utils') +const { waitWorkerEvents } = require('../../test-utils') describe('Fixed thread pool test suite', () => { const numberOfThreads = 6 @@ -149,6 +149,7 @@ describe('Fixed thread pool test suite', () => { expect(typeof inError.message === 'string').toBe(true) expect(inError.message).toBe('Error Message from ThreadWorker') expect(taskError).toStrictEqual({ + workerId: expect.any(Number), message: new Error('Error Message from ThreadWorker'), data }) @@ -177,6 +178,7 @@ describe('Fixed thread pool test suite', () => { expect(typeof inError.message === 'string').toBe(true) expect(inError.message).toBe('Error Message from ThreadWorker:async') expect(taskError).toStrictEqual({ + workerId: expect.any(Number), message: new Error('Error Message from ThreadWorker:async'), data }) @@ -197,11 +199,7 @@ describe('Fixed thread pool test suite', () => { }) it('Shutdown test', async () => { - const exitPromise = TestUtils.waitWorkerEvents( - pool, - 'exit', - numberOfThreads - ) + const exitPromise = waitWorkerEvents(pool, 'exit', numberOfThreads) await pool.destroy() const numberOfExitEvents = await exitPromise expect(numberOfExitEvents).toBe(numberOfThreads)