Chapter 4. Test Spies

As we begin looking at the more complicated parts of our Backbone.js application, the process of isolating dependencies and testable behaviors can become an increasingly daunting task. To provide a little help in these areas, we will introduce Sinon.JS, which is a powerful test mock, stub, and spy library, in this chapter.

Sinon.JS allows us to artificially isolate Backbone.js components and test specific behaviors without interacting with the rest of the application. We will kick off our discussion on Sinon.JS with the following topics:

  • Identifying some of the test limitations typically found in Backbone.js applications and testing scenarios that can benefit from test fakes
  • Introducing the Sinon.JS test double and assertion ...

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.