test: improve worker choice strategies options coverage
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 19 Jun 2023 11:28:48 +0000 (13:28 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 19 Jun 2023 11:28:48 +0000 (13:28 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
tests/pools/abstract/abstract-pool.test.js

index fc386f375513cbfe35e9eb220ee5598e1e562008..b6219ce954e21c878df1c2a67ce0e86031ceddc0 100644 (file)
@@ -329,6 +329,21 @@ describe('Abstract pool test suite', () => {
         median: false
       }
     })
+    expect(() =>
+      pool.setWorkerChoiceStrategyOptions('invalidWorkerChoiceStrategyOptions')
+    ).toThrowError(
+      'Invalid worker choice strategy options: must be a plain object'
+    )
+    expect(() =>
+      pool.setWorkerChoiceStrategyOptions({ weights: {} })
+    ).toThrowError(
+      'Invalid worker choice strategy options: must have a weight for each worker node'
+    )
+    expect(() =>
+      pool.setWorkerChoiceStrategyOptions({ measurement: 'invalidMeasurement' })
+    ).toThrowError(
+      "Invalid worker choice strategy options: invalid measurement 'invalidMeasurement'"
+    )
     await pool.destroy()
   })