From: Jérôme Benoit Date: Sat, 12 Aug 2023 09:45:13 +0000 (+0200) Subject: test: add test for transferable objects in execute() for worker_threads X-Git-Tag: v2.6.24~11 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9ea61037de674cfeda9f3e3bc897df0ccbaff4ec;p=poolifier.git test: add test for transferable objects in execute() for worker_threads pool Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/thread/fixed.test.js b/tests/pools/thread/fixed.test.js index 080ebad6..849590a6 100644 --- a/tests/pools/thread/fixed.test.js +++ b/tests/pools/thread/fixed.test.js @@ -155,6 +155,19 @@ describe('Fixed thread pool test suite', () => { expect(result).toStrictEqual(data) }) + it('Verify that transferable objects are sent to the worker correctly', async () => { + const transferList = [new ArrayBuffer(16), new MessageChannel().port1] + let error + let result + try { + result = await pool.execute(undefined, undefined, transferList) + } catch (e) { + error = e + } + expect(result).toStrictEqual({ ok: 1 }) + expect(error).toBeUndefined() + }) + it('Verify that error handling is working properly:sync', async () => { const data = { f: 10 } let taskError