X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker%2Fcluster-worker.test.mjs;h=228a969a574473c1ab78fa5e6c502baa8a1b9871;hb=e334515bf28581c234d6b9f5239425c9a0c6a7ec;hp=b785010ec5cf7b61999852c53658091abba0e5f5;hpb=5eb72b9e26eaffb43c67147fbc6b4d2b1b959d62;p=poolifier.git diff --git a/tests/worker/cluster-worker.test.mjs b/tests/worker/cluster-worker.test.mjs index b785010e..228a969a 100644 --- a/tests/worker/cluster-worker.test.mjs +++ b/tests/worker/cluster-worker.test.mjs @@ -1,13 +1,22 @@ import { expect } from 'expect' import { restore, stub } from 'sinon' -import { ClusterWorker } from '../../lib/index.js' -import { DEFAULT_TASK_NAME } from '../../lib/utils.js' + +import { ClusterWorker } from '../../lib/index.cjs' +import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs' describe('Cluster worker test suite', () => { afterEach(() => { 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()