From 175b36057fbf976bc2182212e72051eff93ba0fd Mon Sep 17 00:00:00 2001 From: Priojeet Das Priyom Date: Fri, 6 Oct 2023 16:31:26 +0200 Subject: [PATCH] Make delay and waitForIt test limit more accurate --- services/blockchain-connector/tests/unit/delay.test.js | 2 +- services/blockchain-connector/tests/unit/waitForIt.test.js | 2 +- services/gateway/tests/unit/shared/waitForIt.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/blockchain-connector/tests/unit/delay.test.js b/services/blockchain-connector/tests/unit/delay.test.js index 3f24bbf1bb..eb77da03a1 100644 --- a/services/blockchain-connector/tests/unit/delay.test.js +++ b/services/blockchain-connector/tests/unit/delay.test.js @@ -30,6 +30,6 @@ describe('Test delay method', () => { await delay(delayMs); const endTime = Date.now(); const millisDifference = endTime - startTime; - expect(millisDifference).toBeGreaterThanOrEqual(delayMs * 0.98); + expect(millisDifference).toBeGreaterThanOrEqual(delayMs - 1); }); }); diff --git a/services/blockchain-connector/tests/unit/waitForIt.test.js b/services/blockchain-connector/tests/unit/waitForIt.test.js index 5e8ca6bae6..e26e889046 100644 --- a/services/blockchain-connector/tests/unit/waitForIt.test.js +++ b/services/blockchain-connector/tests/unit/waitForIt.test.js @@ -36,7 +36,7 @@ describe('Test waitForIt method', () => { await waitForIt(testFn); const endTime = Date.now(); const millisDifference = endTime - startTime; - expect(millisDifference).toBeGreaterThanOrEqual(delayMs * 0.98); + expect(millisDifference).toBeGreaterThanOrEqual(delayMs - 1); }); it('should wait for the mocked function to return response', async () => { diff --git a/services/gateway/tests/unit/shared/waitForIt.test.js b/services/gateway/tests/unit/shared/waitForIt.test.js index ec5615c795..229d470a54 100644 --- a/services/gateway/tests/unit/shared/waitForIt.test.js +++ b/services/gateway/tests/unit/shared/waitForIt.test.js @@ -38,7 +38,7 @@ describe('Test waitForIt method', () => { await waitForIt(testFn); const endTime = Date.now(); const millisDifference = endTime - startTime; - expect(millisDifference).toBeGreaterThanOrEqual(delayMs * 0.98); + expect(millisDifference).toBeGreaterThanOrEqual(delayMs - 1); }); it('should wait for the mocked function to return response', async () => {