From: Jérôme Benoit Date: Mon, 8 May 2023 11:27:58 +0000 (+0200) Subject: test: improve error handling tests X-Git-Tag: v2.4.13~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=18482cecfe80c8f9215650fb6b2c3ee785bb6368;p=poolifier.git test: improve error handling tests Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/cluster/fixed.test.js b/tests/pools/cluster/fixed.test.js index 34c066100..8234fab9a 100644 --- a/tests/pools/cluster/fixed.test.js +++ b/tests/pools/cluster/fixed.test.js @@ -137,6 +137,11 @@ describe('Fixed cluster pool test suite', () => { 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 () => { @@ -150,6 +155,11 @@ describe('Fixed cluster pool test suite', () => { 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 () => { diff --git a/tests/pools/thread/fixed.test.js b/tests/pools/thread/fixed.test.js index 09c53ea49..aed2b3c19 100644 --- a/tests/pools/thread/fixed.test.js +++ b/tests/pools/thread/fixed.test.js @@ -139,6 +139,11 @@ describe('Fixed thread pool test suite', () => { expect(inError.message).toBeDefined() expect(typeof inError.message === 'string').toBe(true) expect(inError.message).toBe('Error Message from ThreadWorker') + expect( + errorPool.workerNodes.some( + workerNode => workerNode.tasksUsage.error === 1 + ) + ).toBe(true) }) it('Verify that error handling is working properly:async', async () => { @@ -154,6 +159,11 @@ describe('Fixed thread pool test suite', () => { expect(inError.message).toBeDefined() expect(typeof inError.message === 'string').toBe(true) expect(inError.message).toBe('Error Message from ThreadWorker:async') + expect( + asyncErrorPool.workerNodes.some( + workerNode => workerNode.tasksUsage.error === 1 + ) + ).toBe(true) }) it('Verify that async function is working properly', async () => {