mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
29 lines
573 B
TypeScript
29 lines
573 B
TypeScript
import { expect } from 'chai'
|
|
import sinon from 'sinon'
|
|
import { delay } from '../src/utils.js'
|
|
|
|
describe('utils.ts', () => {
|
|
let clock: sinon.SinonFakeTimers
|
|
|
|
beforeEach(() => {
|
|
clock = sinon.useFakeTimers()
|
|
})
|
|
|
|
afterEach(() => {
|
|
sinon.restore()
|
|
clock.restore()
|
|
})
|
|
|
|
it('will', async () => {
|
|
let delayEnded = false
|
|
delay(31).then(() => {
|
|
delayEnded = true
|
|
})
|
|
expect(delayEnded).to.be.false
|
|
await clock.tickAsync(30)
|
|
expect(delayEnded).to.be.false
|
|
await clock.tickAsync(31)
|
|
expect(delayEnded).to.be.true
|
|
})
|
|
})
|