test: add test for worker task function object
[poolifier.git] / src / worker / utils.ts
index b5c1725a776572116cef3e51a0c9e477d43c45d6..d0883893581b0a14c24cb415bef585541b71c446 100644 (file)
@@ -1,4 +1,7 @@
-import { checkValidWorkerChoiceStrategy } from '../pools/utils.js'
+import {
+  checkValidPriority,
+  checkValidWorkerChoiceStrategy
+} from '../pools/utils.js'
 import { isPlainObject } from '../utils.js'
 import type { TaskFunctionObject } from './task-functions.js'
 import { KillBehaviors, type WorkerOptions } from './worker-options.js'
@@ -54,11 +57,7 @@ export const checkValidTaskFunctionObjectEntry = <
       `taskFunction object 'taskFunction' property '${fnObj.taskFunction}' is not a function`
     )
   }
-  if (fnObj.priority != null && !Number.isSafeInteger(fnObj.priority)) {
-    throw new TypeError(
-      `taskFunction object 'priority' property '${fnObj.priority}' is not an integer`
-    )
-  }
+  checkValidPriority(fnObj.priority)
   checkValidWorkerChoiceStrategy(fnObj.strategy)
 }