X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker%2Fthread-worker.test.mjs;h=6d694ec6464c412d1d3860d246438689abb44e47;hb=5bbdaeff9b95f2ecb177394f869e9d0715e38e9e;hp=81b096f2b8b308812089cdebfb234e15954199ba;hpb=f8b3d84c1c95773a1e18d2c025d89d73c4f2ab15;p=poolifier.git diff --git a/tests/worker/thread-worker.test.mjs b/tests/worker/thread-worker.test.mjs index 81b096f2..6d694ec6 100644 --- a/tests/worker/thread-worker.test.mjs +++ b/tests/worker/thread-worker.test.mjs @@ -1,13 +1,22 @@ import { expect } from 'expect' import { restore, stub } from 'sinon' -import { ThreadWorker } from '../../lib/index.js' -import { DEFAULT_TASK_NAME } from '../../lib/utils.js' + +import { ThreadWorker } from '../../lib/index.cjs' +import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs' describe('Thread worker test suite', () => { afterEach(() => { 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()