Chapter 9. Testing Redux applications

 

This chapter covers

  • Introducing testing tools
  • Strategies for testing Redux building blocks
  • Testing advanced Redux features

Instead of testing each Parsnip feature as it was built, our strategy has been to save it all up for one comprehensive chapter. Ideally, this chapter serves as a convenient reference manual for all your Redux testing needs going forward. In the coming sections, we cover common testing tools and strategies for testing action creators, reducers, and components. We also work through examples for testing advanced features: middleware, selectors, and sagas. Feel free to skip around as needed.

Because this chapter is intended to be easily referenced outside the context of the Parsnip application, examples will be inspired by code written for Parsnip but may be pared down to make a clearer point. In the process, you’ll gain the knowledge and tools necessary for testing Parsnip code, so the exercise at the end of the chapter asks you to do that. You’ll check your understanding by testing a specific feature. As you read through the chapter, consider how the lessons could be extended to test related functionality in Parsnip or your own application.

9.1. Introduction to testing tools

9.2. How does testing Redux differ from React?

9.3. Testing action creators

9.4. Testing sagas

9.5. Testing middleware

9.6. Testing reducers

9.7. Testing selectors

9.8. Testing components

9.9. Exercise

9.10. Solution

Summary

sitemap