Description
Use it to make sure that your React components are tested thoroughly. All examples use the Jest and React Testing Library.
Summary
- TLDR To make it easier to manage your tests organize them using the describe blocks.
- You can plan the tests before writing them using the it.todo syntax.
- It forces you to write the tests from the user perspective instead If your component’s state changes on some user action, for example, button click — click this button in your test using the fireEvent method from @testinglibrary/react and then check the expectation on component render value.
- Create a describe block for every condition value in your layout.