test: verify worker properties value
[poolifier.git] / tests / worker / thread-worker.test.mjs
index 81b096f2b8b308812089cdebfb234e15954199ba..6d694ec6464c412d1d3860d246438689abb44e47 100644 (file)
@@ -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()