Build a button using test driven development
Try out test driven development by building a simple button component.
For this exercise, you're given a set of failing unit tests.
Get the tests to pass by implementing the
You can clone this repo to run the test locally.
If you haven't worked with unit tests before, checkout the official solution for a detailed walkthrough.
Note: The test uses
jest and React Testing Library
What you'll learn
- rendering components in a test context using React Testing Library
- basic RTL methods -
- basic RTL assertions -
- troubleshooting tests with
- mocking event handlers with jest mocks
- simulating user interactions using @testing-library/user-event v14
- async tests