Why should test ReactJS Components

Every component is worth testing even if the test is simple. The test gives you confidence that the component works as expected, produce software with better quality and to do proper refactoring.

Testing tools

You can test react component using  Jest or Enzyme 

Why Jest

  • It’s Very fast
  • Simple configuration
  • Helpful fail messages
  • Awesome interactive watch mode that reruns only tests that are relevant to your changes

Why Enzyme

  • It’s easy to assert, manipulate and traverse your React components outputs
  • Convenient utilities to work with shallow rendering, static rendered markup or DOM rendering.

Check this tutorial for more details. It’s clean and easy to understand and detail oriented
https://hackernoon.com/testing-react-components-with-jest-and-enzyme-41d592c174f

 

Leave a Reply

Your email address will not be published. Required fields are marked *