Merge branch 'master' into feature/task-functions
[poolifier.git] / tests / pools / abstract / abstract-pool.test.js
index df109fe1982e4c511e40a73b9e5449683a18ae00..46f48be526ca3832fd9f46dcde13bb9779f86eea 100644 (file)
@@ -239,7 +239,7 @@ describe('Abstract pool test suite', () => {
       tasksQueueOptions: {
         concurrency: 2,
         size: 4,
-        tasksStealing: true,
+        taskStealing: true,
         tasksStealingOnBackPressure: true
       },
       workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED,
@@ -635,7 +635,7 @@ describe('Abstract pool test suite', () => {
     expect(pool.opts.tasksQueueOptions).toStrictEqual({
       concurrency: 1,
       size: 4,
-      tasksStealing: true,
+      taskStealing: true,
       tasksStealingOnBackPressure: true
     })
     pool.enableTasksQueue(true, { concurrency: 2 })
@@ -643,7 +643,7 @@ describe('Abstract pool test suite', () => {
     expect(pool.opts.tasksQueueOptions).toStrictEqual({
       concurrency: 2,
       size: 4,
-      tasksStealing: true,
+      taskStealing: true,
       tasksStealingOnBackPressure: true
     })
     pool.enableTasksQueue(false)
@@ -661,14 +661,14 @@ describe('Abstract pool test suite', () => {
     expect(pool.opts.tasksQueueOptions).toStrictEqual({
       concurrency: 1,
       size: 4,
-      tasksStealing: true,
+      taskStealing: true,
       tasksStealingOnBackPressure: true
     })
     pool.setTasksQueueOptions({ concurrency: 2 })
     expect(pool.opts.tasksQueueOptions).toStrictEqual({
       concurrency: 2,
       size: 4,
-      tasksStealing: true,
+      taskStealing: true,
       tasksStealingOnBackPressure: true
     })
     expect(() =>
@@ -1197,7 +1197,7 @@ describe('Abstract pool test suite', () => {
       './tests/worker-files/thread/testMultipleTaskFunctionsWorker.js'
     )
     await waitPoolEvents(dynamicThreadPool, PoolEvents.ready, 1)
-    expect(dynamicThreadPool.listTaskFunctions()).toStrictEqual([
+    expect(dynamicThreadPool.listTaskFunctionNames()).toStrictEqual([
       DEFAULT_TASK_NAME,
       'jsonIntegerSerialization',
       'factorial',
@@ -1208,7 +1208,7 @@ describe('Abstract pool test suite', () => {
       './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.js'
     )
     await waitPoolEvents(fixedClusterPool, PoolEvents.ready, 1)
-    expect(fixedClusterPool.listTaskFunctions()).toStrictEqual([
+    expect(fixedClusterPool.listTaskFunctionNames()).toStrictEqual([
       DEFAULT_TASK_NAME,
       'jsonIntegerSerialization',
       'factorial',
@@ -1236,14 +1236,14 @@ describe('Abstract pool test suite', () => {
     expect(pool.info.executingTasks).toBe(0)
     expect(pool.info.executedTasks).toBe(4)
     for (const workerNode of pool.workerNodes) {
-      expect(workerNode.info.taskFunctions).toStrictEqual([
+      expect(workerNode.info.taskFunctionNames).toStrictEqual([
         DEFAULT_TASK_NAME,
         'jsonIntegerSerialization',
         'factorial',
         'fibonacci'
       ])
       expect(workerNode.taskFunctionsUsage.size).toBe(3)
-      for (const name of pool.listTaskFunctions()) {
+      for (const name of pool.listTaskFunctionNames()) {
         expect(workerNode.getTaskFunctionWorkerUsage(name)).toStrictEqual({
           tasks: {
             executed: expect.any(Number),
@@ -1274,7 +1274,9 @@ describe('Abstract pool test suite', () => {
       expect(
         workerNode.getTaskFunctionWorkerUsage(DEFAULT_TASK_NAME)
       ).toStrictEqual(
-        workerNode.getTaskFunctionWorkerUsage(workerNode.info.taskFunctions[1])
+        workerNode.getTaskFunctionWorkerUsage(
+          workerNode.info.taskFunctionNames[1]
+        )
       )
     }
     await pool.destroy()