From 1789b1eb1b65568d8d9cb8213f726f7459d8e5e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 11 Jun 2024 18:29:42 +0200 Subject: [PATCH] test: improve mapExecute() test MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/pools/abstract-pool.test.mjs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/pools/abstract-pool.test.mjs b/tests/pools/abstract-pool.test.mjs index d202d65f..97a2c111 100644 --- a/tests/pools/abstract-pool.test.mjs +++ b/tests/pools/abstract-pool.test.mjs @@ -1714,7 +1714,16 @@ describe('Abstract pool test suite', () => { numberOfWorkers, './tests/worker-files/thread/testMultipleTaskFunctionsWorker.mjs' ) - const results = await pool.mapExecute([{ n: 10 }, { n: 20 }, { n: 30 }, { n: 40 }], 'factorial') + let results = await pool.mapExecute([{}, {}, {}, {}]) + expect(results).toStrictEqual([ + { ok: 1 }, + { ok: 1 }, + { ok: 1 }, + { ok: 1 }, + ]) + expect(pool.info.executingTasks).toBe(0) + expect(pool.info.executedTasks).toBe(4) + results = await pool.mapExecute([{ n: 10 }, { n: 20 }, { n: 30 }, { n: 40 }], 'factorial') expect(results).toStrictEqual([ 3628800, 2432902008176640000, @@ -1722,7 +1731,7 @@ describe('Abstract pool test suite', () => { 8.159152832478977e+47, ]) expect(pool.info.executingTasks).toBe(0) - expect(pool.info.executedTasks).toBe(4) + expect(pool.info.executedTasks).toBe(8) await pool.destroy() }) -- 2.34.1