How do you test react components?
Today, I read a lot of different articles about testing react component. Everyone propose a different test framework and library such as jest, enzyme, etc... They mentioned different things to test a react component such:
- using snapshot.
- Testing props and state.
- Mocking the apis and functions when they will be used in the component.
- Testing the behaviour of a component alone. And so on. I want to know acvording to your experiences in testing react components; -Do you test all the components you designed or you choose some of them?
- What are the important things to test ?
- How do you test container components ( when you use redux)
- Do you respect TDD and write the test before implementing the the component?
- What are the best practices to be token into consideration when writing tests in an application?
- What is the test coverage in an application or it is relative?
3.4K+ developers have started their personal blogs on Hashnode in the last one month.
Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more