datespy

a simple date mocking library
Homepage:
1 person uses it

DateSpy.JS

A Simple Date Mocking Library

DateSpy.JS API

Causes the global setTimeout, clearTimeout, setInterval, clearInterval and Date to be replaced with a custom implementation which is bound to the returned clock object.

As above, but rather than starting the clock at the current timestamp, start at the provided timestamp.

Sets the clock start timestamp and names functions to fake. Possible functions are setTimeout, clearTimeout, setInterval, clearInterval, and Date. Can also be called without the timestamp.

Tick the clock ahead ms milliseconds. Causes all timers scheduled within the affected time range to be called.

Restore the faked methods. Call in e.g. tearDown.

Angular.JS Integration

DateSpy.JS Angular.JS API

Causes the global setTimeout, clearTimeout, setInterval, clearInterval and Date to be replaced with a custom implementation which is bound to the returned clock object.

As above, but rather than starting the clock at the current timestamp, start at the provided timestamp.

Sets the clock start timestamp and names functions to fake. Possible functions are setTimeout, clearTimeout, setInterval, clearInterval, and Date. Can also be called without the timestamp.

Tick the clock ahead ms milliseconds. Causes all timers scheduled within the affected time range to be called.

Restore the faked methods and the global date object. Call in e.g. tearDown.

Build & Coverage Status

Build Status    Coverage Status

comments powered by Disqus
This page was last updated over 3 years ago.