A few more Sinon.JS test helpers
Sinon.JS provides many useful tools beyond the core test double abstractions of spies, stubs, and mocks. We have already been introduced to the sinon.test
wrapper in Chapter 4, Test Spies, and will examine a few more equally convenient helpers in this chapter.
Tip
Some test helpers such as timers and servers may require the use of IE-specific Sinon.JS libraries when used with the Internet Explorer web browser. See the relevant Sinon.JS documentation sections for more details.
Fake timers
Sinon.JS can patch time and date intervals to help manage asynchronous events and callbacks in tests. Sinon.JS fake timers override native JavaScript functions, such as setTimeout
and the Date
class. Once faked, test code must manually ...
Get Backbone.js Testing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.