Skip to Content
Test-Driven JavaScript Development
book

Test-Driven JavaScript Development

by Christian Johansen
September 2010
Intermediate to advanced
600 pages
11h 41m
English
Addison-Wesley Professional
Content preview from Test-Driven JavaScript Development

Chapter 16. Mocking and Stubbing

While using test-driven development to develop five sample projects, we’ve become intimately familiar with the stubFn function. We have used it as a tool to both inspect interaction between objects, as well as isolating interfaces under test. But what exactly is a stub? We are about to find out as we dive a little deeper into the topic of using test doubles, objects that look like the real thing but really are bleak impersonations used to simplify tests.

In this chapter we will look at the general theory of using test doubles, and get to know a few common types of test doubles a little better. Because we have already used stubs extensively in tests throughout Part III, Real-World Test-Driven Development in JavaScript ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Test-Driven JavaScript Development

Test-Driven JavaScript Development

Ravi Kumar Gupta
Front-End Development Projects with Vue.js

Front-End Development Projects with Vue.js

Raymond Camden, Hugo Di Francesco, Clifford Gurney, Philip Kirkbride, Maya Shavin, Dániel Szabó

Publisher Resources

ISBN: 9780321684097Purchase book