mock-timeout
Based on jasmine's jasmine.clock()
mock of setTimeout
, setInterval
,
clearTimeout
, and clearInterval
functions.
Methods
tick(number)
Calls any registered callback are triggered when the clock is ticked forward via this function, which takes a number of milliseconds.
reset()
Clears all callbacks and resets the clock to 0.
Usage
var mockTimeout = ; mockTimeout; var timeoutId = mockTimeout; var intervalId = mockTimeout; mockTimeout; // apple, peach, peach; mockTimeout;mockTimeout; mockTimeout; //
Install
npm install mock-timeout
License
MIT