Skip to content

Commit

Permalink
fix flaky test (#606)
Browse files Browse the repository at this point in the history
Co-authored-by: Seth Silesky <silesky@users.noreply.github.com>
  • Loading branch information
silesky and silesky authored Sep 29, 2022
1 parent deadc7c commit 4ce4934
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/core/src/analytics/__tests__/dispatch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,15 @@ describe(getDelay, () => {
it('should calculate the amount of time to delay before invoking the callback', () => {
const aShortTimeAgo = Date.now() - 200
const timeout = 5000
expect(Math.round(getDelay(aShortTimeAgo, timeout))).toBe(4800)
const result = getDelay(aShortTimeAgo, timeout)
expect(result).toBeLessThanOrEqual(4800)
expect(result).toBeGreaterThanOrEqual(4790)
})

it('should have a sensible default', () => {
const aShortTimeAgo = Date.now() - 200
expect(Math.round(getDelay(aShortTimeAgo))).toBe(100)
const result = getDelay(aShortTimeAgo)
expect(result).toBeLessThanOrEqual(100)
expect(result).toBeGreaterThanOrEqual(90)
})
})

0 comments on commit 4ce4934

Please sign in to comment.