fix: ensure the task concurrency is respected at queued task
[poolifier.git] / tests / pools / abstract / abstract-pool.test.js
index b26ca43d6ef0cc37354d598db8dd3851e686fdca..2c904362a742eb8594a00a9bf216e7cb3707e455 100644 (file)
@@ -86,6 +86,42 @@ 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(
+          0.5,
+          1,
+          './tests/worker-files/thread/testWorker.js'
+        )
+    ).toThrowError(
+      new TypeError(
+        'Cannot instantiate a pool with a non safe integer number of workers'
+      )
+    )
+    expect(
+      () =>
+        new DynamicClusterPool(
+          0,
+          0.5,
+          './tests/worker-files/cluster/testWorker.js'
+        )
+    ).toThrowError(
+      new TypeError(
+        'Cannot instantiate a dynamic pool with a non safe integer maximum pool size'
+      )
+    )
     expect(
       () =>
         new DynamicThreadPool(2, 1, './tests/worker-files/thread/testWorker.js')
@@ -96,7 +132,11 @@ describe('Abstract pool test suite', () => {
     )
     expect(
       () =>
-        new DynamicThreadPool(1, 1, './tests/worker-files/thread/testWorker.js')
+        new DynamicClusterPool(
+          1,
+          1,
+          './tests/worker-files/cluster/testWorker.js'
+        )
     ).toThrowError(
       new RangeError(
         'Cannot instantiate a dynamic pool with a minimum pool size equal to the maximum pool size. Use a fixed pool instead'