Chapter 3. Testing rendered component output
This chapter covers
- Testing component output
- Writing a static Hacker News feed
If a tree falls in a forest and no one is around to hear it, does it make a sound? More importantly, if a component is mounted and no one writes a test for it, did it generate output?
Testing is about input and output. In a test you supply an input, receive an output, and assert that the output is correct. The most common output of components is the rendered output—the stuff that render functions generate. That’s what this chapter is about: testing rendered component output.
To learn how to test component output, you’ll write a static Hacker News feed. The news feed is simple, but it gives you the opportunity to test ...