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.