O'Reilly logo

Backbone.js Testing by Ryan Roemer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required