From: Jérôme Benoit Date: Thu, 4 Apr 2024 08:53:46 +0000 (+0200) Subject: test: verify worker properties value X-Git-Tag: v3.1.30~40 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=394676d15b59b7013b9d95889e47a4a49860b057;hp=5bec72fd7d60b510224f9dd6bc2c04df4cd23e39;p=poolifier.git test: verify worker properties value Signed-off-by: Jérôme Benoit --- 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()