test: fix flakiness
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 25 Aug 2023 22:52:18 +0000 (00:52 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 25 Aug 2023 22:52:18 +0000 (00:52 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
tests/utils.test.js

index c00f0307d45b257da730c3cb55f72ba96f15789c..42a0668ab3c19d55080682f39e3ecfbb78df5090 100644 (file)
@@ -27,10 +27,10 @@ describe('Utils test suite', () => {
   })
 
   it('Verify sleep() behavior', async () => {
-    const now = performance.now()
+    const start = performance.now()
     await sleep(1000)
-    const elapsed = performance.now() - now
-    expect(elapsed).toBeGreaterThanOrEqual(1000)
+    const stop = performance.now()
+    expect(stop - start).toBeGreaterThanOrEqual(1000)
   })
 
   it('Verify exponentialDelay() behavior', () => {