refactor: make TS example compatible with latest ES version
[poolifier.git] / tests / pools / abstract / abstract-pool.test.js
index 10736b6bcd1c49e4b7dbbd7d8231ca4c93f69599..5ac704a60eff0a19588ffbbda41ff36a981021a6 100644 (file)
@@ -86,6 +86,18 @@ describe('Abstract pool test suite', () => {
   })
 
   it('Verify that dynamic pool sizing is checked', () => {
+    expect(
+      () =>
+        new DynamicClusterPool(
+          1,
+          undefined,
+          './tests/worker-files/cluster/testWorker.js'
+        )
+    ).toThrowError(
+      new TypeError(
+        'Cannot instantiate a dynamic pool without specifying the maximum pool size'
+      )
+    )
     expect(
       () =>
         new DynamicThreadPool(
@@ -103,7 +115,7 @@ describe('Abstract pool test suite', () => {
         new DynamicClusterPool(
           0,
           0.5,
-          './tests/worker-files/thread/testWorker.js'
+          './tests/worker-files/cluster/testWorker.js'
         )
     ).toThrowError(
       new TypeError(
@@ -123,7 +135,7 @@ describe('Abstract pool test suite', () => {
         new DynamicClusterPool(
           1,
           1,
-          './tests/worker-files/thread/testWorker.js'
+          './tests/worker-files/cluster/testWorker.js'
         )
     ).toThrowError(
       new RangeError(
@@ -163,7 +175,7 @@ describe('Abstract pool test suite', () => {
     expect(pool.opts.onlineHandler).toBeUndefined()
     expect(pool.opts.exitHandler).toBeUndefined()
     await pool.destroy()
-    const testHandler = () => console.log('test handler executed')
+    const testHandler = () => console.info('test handler executed')
     pool = new FixedThreadPool(
       numberOfWorkers,
       './tests/worker-files/thread/testWorker.js',
@@ -466,8 +478,6 @@ describe('Abstract pool test suite', () => {
       busyWorkerNodes: 0,
       executedTasks: 0,
       executingTasks: 0,
-      queuedTasks: 0,
-      maxQueuedTasks: 0,
       failedTasks: 0
     })
     await pool.destroy()
@@ -489,8 +499,6 @@ describe('Abstract pool test suite', () => {
       busyWorkerNodes: 0,
       executedTasks: 0,
       executingTasks: 0,
-      queuedTasks: 0,
-      maxQueuedTasks: 0,
       failedTasks: 0
     })
     await pool.destroy()
@@ -757,8 +765,6 @@ describe('Abstract pool test suite', () => {
       busyWorkerNodes: expect.any(Number),
       executedTasks: expect.any(Number),
       executingTasks: expect.any(Number),
-      queuedTasks: expect.any(Number),
-      maxQueuedTasks: expect.any(Number),
       failedTasks: expect.any(Number)
     })
     await pool.destroy()
@@ -791,8 +797,6 @@ describe('Abstract pool test suite', () => {
       busyWorkerNodes: expect.any(Number),
       executedTasks: expect.any(Number),
       executingTasks: expect.any(Number),
-      queuedTasks: expect.any(Number),
-      maxQueuedTasks: expect.any(Number),
       failedTasks: expect.any(Number)
     })
     await pool.destroy()
@@ -830,8 +834,6 @@ describe('Abstract pool test suite', () => {
       busyWorkerNodes: expect.any(Number),
       executedTasks: expect.any(Number),
       executingTasks: expect.any(Number),
-      queuedTasks: expect.any(Number),
-      maxQueuedTasks: expect.any(Number),
       failedTasks: expect.any(Number)
     })
     await pool.destroy()