From 394676d15b59b7013b9d95889e47a4a49860b057 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 4 Apr 2024 10:53:46 +0200 Subject: [PATCH] test: verify worker properties value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/worker/cluster-worker.test.mjs | 8 ++++++++ tests/worker/thread-worker.test.mjs | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/worker/cluster-worker.test.mjs b/tests/worker/cluster-worker.test.mjs index 3392d96c..228a969a 100644 --- a/tests/worker/cluster-worker.test.mjs +++ b/tests/worker/cluster-worker.test.mjs @@ -9,6 +9,14 @@ describe('Cluster worker test suite', () => { restore() }) + it('Verify worker properties value after initialization', () => { + const worker = new ClusterWorker(() => {}) + expect(worker.isMain).toBe(true) + expect(worker.mainWorker).toBe(undefined) + expect(worker.taskFunctions).toBeInstanceOf(Map) + expect(worker.taskFunctions.size).toBe(2) + }) + it('Verify that sync kill handler is called when worker is killed', () => { const worker = new ClusterWorker(() => {}, { killHandler: stub().returns() diff --git a/tests/worker/thread-worker.test.mjs b/tests/worker/thread-worker.test.mjs index e4a408d5..6d694ec6 100644 --- a/tests/worker/thread-worker.test.mjs +++ b/tests/worker/thread-worker.test.mjs @@ -9,6 +9,14 @@ describe('Thread worker test suite', () => { restore() }) + it('Verify worker properties value after initialization', () => { + const worker = new ThreadWorker(() => {}) + expect(worker.isMain).toBe(true) + expect(worker.mainWorker).toBe(null) + expect(worker.taskFunctions).toBeInstanceOf(Map) + expect(worker.taskFunctions.size).toBe(2) + }) + it('Verify that sync kill handler is called when worker is killed', () => { const worker = new ThreadWorker(() => {}, { killHandler: stub().returns() -- 2.34.1