From 9ea61037de674cfeda9f3e3bc897df0ccbaff4ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 12 Aug 2023 11:45:13 +0200 Subject: [PATCH] test: add test for transferable objects in execute() for worker_threads pool MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/pools/thread/fixed.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- 2.34.1