perf: remove unneeded class indirection for dynamic pool in worker
[poolifier.git] / tests / worker / cluster-worker.test.js
index fc2d3442eb58fd816601cea6d8a7bc0384dd380b..ff749c8f721f964762c144ece84a7933711367fa 100644 (file)
@@ -1,10 +1,15 @@
-const expect = require('expect')
+const { expect } = require('expect')
 const { ClusterWorker } = require('../../lib')
 
 describe('Cluster worker test suite', () => {
-  // Skipped because ClusterWorker would be in main instead of non-main worker
-  it.skip('Verify worker has default maxInactiveTime', () => {
+  it('Verify worker has default maxInactiveTime', () => {
     const worker = new ClusterWorker(() => {})
-    expect(worker.maxInactiveTime).toEqual(60_000)
+    expect(worker.opts.maxInactiveTime).toStrictEqual(60000)
+  })
+
+  it('Verify that handleError function works properly', () => {
+    const errorMessage = 'Error as a string'
+    const worker = new ClusterWorker(() => {})
+    expect(worker.handleError(errorMessage)).toStrictEqual(errorMessage)
   })
 })