Home > @wixc3/testing > useSafeFakeTimers
Makes it easy to safely use fake timers
Signature:
export declare function useSafeFakeTimers(): Sinon.SinonFakeTimers;
Returns:
Sinon.SinonFakeTimers
describe('suite', ()=>{
// DO NOT DESTRUCTURE clock here
const clock = useSafeFakeTimers()
it('uses fake times', ()=>{
const {tick} = clock
let wasCalled=false
setTimeout(() => wasCalled=true, 100)
tick(100)
expect(wasCalled).to.equal(true)
})
})