Chapter 2: Working with React Testing Library
By the end of this chapter, you will know how to add React Testing Library to React projects. React Testing Library is a modern tool for testing the UI output of React components from the perspective of end users. You will learn how to properly structure tests using the methods from the API. You will learn how to test presentational components. Finally, you will learn how to use the debug
method to assist in building out your tests.
In this chapter, we're going to cover the following topics:
- Adding React Testing Library to existing projects
- Structuring tests with React Testing Library
- Testing presentational components
- Using the
debug
method while writing tests
The skills you will learn in this chapter will set the foundation for more complex component scenarios in later chapters.