DEV Community

Discussion on: Understanding React Testing Library

Collapse
 
dhaiwat10 profile image
Dhaiwat Pandya

This library does not replace Jest. It's not a test runner.

And like I mentioned in the article, React Testing Library forces you to test your components from your user's perspective. I know you can do that with Snapshots, but the examples I put in my article are very very basic. The library allows you to do much more than these things.

With Enzyme, it’s common to find elements in the page by their class, which is not meaningful because users do not see those in the UI. With react-testing-library, you search directly by the actual text that the user sees without the overhead work of finding the element that contains that text.