From: Jérôme Benoit Date: Sun, 3 Sep 2023 12:39:42 +0000 (+0200) Subject: test: fix UTs X-Git-Tag: v2.6.41~4 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b7d085c432048df7f7d9fd555f7ada41d5078405;p=poolifier.git test: fix UTs Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 0b56cbe4..ab7fcf51 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -297,37 +297,37 @@ export abstract class AbstractPool< throw new TypeError('Invalid tasks queue options: must be a plain object') } if ( - tasksQueueOptions.concurrency != null && - !Number.isSafeInteger(tasksQueueOptions.concurrency) + tasksQueueOptions?.concurrency != null && + !Number.isSafeInteger(tasksQueueOptions?.concurrency) ) { throw new TypeError( 'Invalid worker node tasks concurrency: must be an integer' ) } if ( - tasksQueueOptions.concurrency != null && - tasksQueueOptions.concurrency <= 0 + tasksQueueOptions?.concurrency != null && + tasksQueueOptions?.concurrency <= 0 ) { throw new RangeError( - `Invalid worker node tasks concurrency: ${tasksQueueOptions.concurrency} is a negative integer or zero` + `Invalid worker node tasks concurrency: ${tasksQueueOptions?.concurrency} is a negative integer or zero` ) } - if (tasksQueueOptions.queueMaxSize != null) { + if (tasksQueueOptions?.queueMaxSize != null) { throw new Error( 'Invalid tasks queue options: queueMaxSize is deprecated, please use size instead' ) } if ( - tasksQueueOptions.size != null && - !Number.isSafeInteger(tasksQueueOptions.size) + tasksQueueOptions?.size != null && + !Number.isSafeInteger(tasksQueueOptions?.size) ) { throw new TypeError( 'Invalid worker node tasks queue size: must be an integer' ) } - if (tasksQueueOptions.size != null && tasksQueueOptions.size <= 0) { + if (tasksQueueOptions?.size != null && tasksQueueOptions?.size <= 0) { throw new RangeError( - `Invalid worker node tasks queue size: ${tasksQueueOptions.size} is a negative integer or zero` + `Invalid worker node tasks queue size: ${tasksQueueOptions?.size} is a negative integer or zero` ) } }