test: improve error handling tests
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 8 May 2023 11:27:58 +0000 (13:27 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 8 May 2023 11:27:58 +0000 (13:27 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
tests/pools/cluster/fixed.test.js
tests/pools/thread/fixed.test.js

index 34c066100aff925579f80a8876c03a4b4d81e695..8234fab9a5f4f4e62b72f8ecdabd51b94f046c4d 100644 (file)
@@ -137,6 +137,11 @@ describe('Fixed cluster pool test suite', () => {
     expect(inError).toBeDefined()
     expect(typeof inError === 'string').toBe(true)
     expect(inError).toBe('Error Message from ClusterWorker')
+    expect(
+      errorPool.workerNodes.some(
+        workerNode => workerNode.tasksUsage.error === 1
+      )
+    ).toBe(true)
   })
 
   it('Verify that error handling is working properly:async', async () => {
@@ -150,6 +155,11 @@ describe('Fixed cluster pool test suite', () => {
     expect(inError).toBeDefined()
     expect(typeof inError === 'string').toBe(true)
     expect(inError).toBe('Error Message from ClusterWorker:async')
+    expect(
+      asyncErrorPool.workerNodes.some(
+        workerNode => workerNode.tasksUsage.error === 1
+      )
+    ).toBe(true)
   })
 
   it('Verify that async function is working properly', async () => {
index 09c53ea49a6afd86338679684d16e904fb2d4f75..aed2b3c193ffe90977fa9f853aa670f0eaff51b5 100644 (file)
@@ -139,6 +139,11 @@ describe('Fixed thread pool test suite', () => {
     expect(inError.message).toBeDefined()
     expect(typeof inError.message === 'string').toBe(true)
     expect(inError.message).toBe('Error Message from ThreadWorker')
+    expect(
+      errorPool.workerNodes.some(
+        workerNode => workerNode.tasksUsage.error === 1
+      )
+    ).toBe(true)
   })
 
   it('Verify that error handling is working properly:async', async () => {
@@ -154,6 +159,11 @@ describe('Fixed thread pool test suite', () => {
     expect(inError.message).toBeDefined()
     expect(typeof inError.message === 'string').toBe(true)
     expect(inError.message).toBe('Error Message from ThreadWorker:async')
+    expect(
+      asyncErrorPool.workerNodes.some(
+        workerNode => workerNode.tasksUsage.error === 1
+      )
+    ).toBe(true)
   })
 
   it('Verify that async function is working properly', async () => {