test: refine some expectations
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 28 Aug 2023 16:52:30 +0000 (18:52 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 28 Aug 2023 16:52:30 +0000 (18:52 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
tests/pools/abstract/abstract-pool.test.js
tests/pools/abstract/worker-node.test.js
tests/pools/selection-strategies/selection-strategies.test.js

index ba9fc4f71825a084881cd86e5a401bd6de80cbda..eecc0779254fc184b2db71b6366acdaedf707888 100644 (file)
@@ -776,17 +776,17 @@ describe('Abstract pool test suite', () => {
           failed: 0
         },
         runTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         waitTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         elu: {
           idle: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           },
           active: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           }
         }
       })
@@ -1225,7 +1225,7 @@ describe('Abstract pool test suite', () => {
         expect(workerNode.getTaskFunctionWorkerUsage(name)).toStrictEqual({
           tasks: {
             executed: expect.any(Number),
-            executing: expect.any(Number),
+            executing: 0,
             failed: 0,
             queued: 0,
             stolen: 0
@@ -1246,8 +1246,8 @@ describe('Abstract pool test suite', () => {
           }
         })
         expect(
-          workerNode.getTaskFunctionWorkerUsage(name).tasks.executing
-        ).toBeGreaterThanOrEqual(0)
+          workerNode.getTaskFunctionWorkerUsage(name).tasks.executed
+        ).toBeGreaterThan(0)
       }
     }
     await pool.destroy()
index 12e05436bb001dfb07fb1421a1e0be1cececa901..df4e03fead8e71319bbab00178297d9e80ea9060 100644 (file)
@@ -47,17 +47,17 @@ describe('Worker node test suite', () => {
         failed: 0
       },
       runTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       waitTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       elu: {
         idle: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         active: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         }
       }
     })
@@ -85,17 +85,17 @@ describe('Worker node test suite', () => {
         failed: 0
       },
       runTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       waitTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       elu: {
         idle: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         active: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         }
       }
     })
@@ -134,17 +134,17 @@ describe('Worker node test suite', () => {
         failed: 0
       },
       runTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       waitTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       elu: {
         idle: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         active: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         }
       }
     })
@@ -157,17 +157,17 @@ describe('Worker node test suite', () => {
         failed: 0
       },
       runTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       waitTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       elu: {
         idle: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         active: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         }
       }
     })
@@ -180,17 +180,17 @@ describe('Worker node test suite', () => {
         failed: 0
       },
       runTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       waitTime: {
-        history: expect.any(CircularArray)
+        history: new CircularArray()
       },
       elu: {
         idle: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         active: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         }
       }
     })
index 6b5dfdb567e5e220b63afafed22b91702dc699b9..253238ba313225abc3e384bf6c8ae1b47f56baae 100644 (file)
@@ -259,17 +259,17 @@ describe('Selection strategies test suite', () => {
           failed: 0
         },
         runTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         waitTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         elu: {
           idle: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           },
           active: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           }
         }
       })
@@ -308,17 +308,17 @@ describe('Selection strategies test suite', () => {
           failed: 0
         },
         runTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         waitTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         elu: {
           idle: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           },
           active: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           }
         }
       })
@@ -508,17 +508,17 @@ describe('Selection strategies test suite', () => {
           failed: 0
         },
         runTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         waitTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         elu: {
           idle: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           },
           active: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           }
         }
       })
@@ -556,17 +556,17 @@ describe('Selection strategies test suite', () => {
           failed: 0
         },
         runTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         waitTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         elu: {
           idle: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           },
           active: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           }
         }
       })
@@ -1861,17 +1861,17 @@ describe('Selection strategies test suite', () => {
           failed: 0
         },
         runTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         waitTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         elu: {
           idle: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           },
           active: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           }
         }
       })
@@ -1932,17 +1932,17 @@ describe('Selection strategies test suite', () => {
           failed: 0
         },
         runTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         waitTime: {
-          history: expect.any(CircularArray)
+          history: new CircularArray()
         },
         elu: {
           idle: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           },
           active: {
-            history: expect.any(CircularArray)
+            history: new CircularArray()
           }
         }
       })