X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker%2Fthread-worker.test.mjs;h=6d694ec6464c412d1d3860d246438689abb44e47;hb=e334515bf28581c234d6b9f5239425c9a0c6a7ec;hp=77bb6c08937dd2937bb069e702be43d526865585;hpb=d35e571704515a8b729d3455e4784054f07c368f;p=poolifier.git diff --git a/tests/worker/thread-worker.test.mjs b/tests/worker/thread-worker.test.mjs index 77bb6c08..6d694ec6 100644 --- a/tests/worker/thread-worker.test.mjs +++ b/tests/worker/thread-worker.test.mjs @@ -1,5 +1,6 @@ import { expect } from 'expect' import { restore, stub } from 'sinon' + import { ThreadWorker } from '../../lib/index.cjs' import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs' @@ -8,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()