Skip to content

Commit

Permalink
Use performance.now() instead of Date.now() for time promise tests
Browse files Browse the repository at this point in the history
  • Loading branch information
saaj committed Aug 25, 2024
1 parent 83602f6 commit b42e7b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/lib/utils/time.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ describe('time.js', () => {
})

it('sleep resolves after n ms', async () => {
let before = Date.now()
let before = performance.now()
await time.sleep(10)
expect(Date.now() - before).to.be.least(10)
expect(performance.now() - before).to.be.least(10)

before = Date.now()
before = performance.now()
await time.sleep(30)
expect(Date.now() - before).to.be.least(30)
expect(performance.now() - before).to.be.least(30)
})
})

0 comments on commit b42e7b5

Please sign in to comment.