In this chapter, we explored test doubles and how they are used to verify interactions with collaborating objects. We looked in detail at spies and stubs, the two main types of doubles you'll use. As we went through, we used a couple of additional testing techniques: we built a Jest matcher, and we built a side-by-side implementation that helped us keep most of our existing tests green as we reworked our component.
Then we removed our hand-rolled code in favor of Jest's own built-in functionality, which helped to dry up our tests.
We also extracted a bunch of helper code into modules that made our tests more readable, because they are shorter and clearer about their intent.
In the next chapter, we'll tie each of our components together into an application with a working data flow.