feat: add task function properties support
[poolifier.git] / tests / pools / worker-node.test.mjs
index 5633530f35d6fd0d06c1cae72af18405daabb997..6aa889baa9bc4b1edb48d0dbcbd6d79592398f4b 100644 (file)
@@ -214,18 +214,25 @@ describe('Worker node test suite', () => {
       threadWorkerNode.getTaskFunctionWorkerUsage('invalidTaskFunction')
     ).toThrow(
       new TypeError(
-        "Cannot get task function worker usage for task function name 'invalidTaskFunction' when task function names list is not yet defined"
+        "Cannot get task function worker usage for task function name 'invalidTaskFunction' when task function properties list is not yet defined"
       )
     )
-    threadWorkerNode.info.taskFunctionNames = [DEFAULT_TASK_NAME, 'fn1']
+    threadWorkerNode.info.taskFunctionsProperties = [
+      { name: DEFAULT_TASK_NAME },
+      { name: 'fn1' }
+    ]
     expect(() =>
       threadWorkerNode.getTaskFunctionWorkerUsage('invalidTaskFunction')
     ).toThrow(
       new TypeError(
-        "Cannot get task function worker usage for task function name 'invalidTaskFunction' when task function names list has less than 3 elements"
+        "Cannot get task function worker usage for task function name 'invalidTaskFunction' when task function properties list has less than 3 elements"
       )
     )
-    threadWorkerNode.info.taskFunctionNames = [DEFAULT_TASK_NAME, 'fn1', 'fn2']
+    threadWorkerNode.info.taskFunctionsProperties = [
+      { name: DEFAULT_TASK_NAME },
+      { name: 'fn1' },
+      { name: 'fn2' }
+    ]
     expect(
       threadWorkerNode.getTaskFunctionWorkerUsage(DEFAULT_TASK_NAME)
     ).toStrictEqual({
@@ -304,10 +311,10 @@ describe('Worker node test suite', () => {
   })
 
   it('Worker node deleteTaskFunctionWorkerUsage()', () => {
-    expect(threadWorkerNode.info.taskFunctionNames).toStrictEqual([
-      DEFAULT_TASK_NAME,
-      'fn1',
-      'fn2'
+    expect(threadWorkerNode.info.taskFunctionsProperties).toStrictEqual([
+      { name: DEFAULT_TASK_NAME },
+      { name: 'fn1' },
+      { name: 'fn2' }
     ])
     expect(threadWorkerNode.taskFunctionsUsage.size).toBe(2)
     expect(