From: Jérôme Benoit Date: Mon, 19 Jun 2023 11:28:48 +0000 (+0200) Subject: test: improve worker choice strategies options coverage X-Git-Tag: v2.6.3~9 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1f95d54467e83cf9fb877f053ee0fb932a8d6264;p=poolifier.git test: improve worker choice strategies options coverage Signed-off-by: Jérôme Benoit --- diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index fc386f37..b6219ce9 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -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() })