Logo Awesome React

Awesome React

Component Unit Testing (and mocking) with react-testing-library 🐐

  • Details
Lots of people make the assumption that react-testing-library is good for React component integration testing, but not very useful for unit testing because it (intentionally) doesn't support shallow rendering. Let's see how you can do unit testing with react-testing-library 🐐

Links:

- Dan's tweet: https://twitter.com/dan_abramov/status/1010102290529902592
- CodeSandbox: https://codesandbox.io/s/github/kentcdodds/react-testing-library-examples/tree/master/?module=%2Fsrc%2F__local_tests__%2Fmock.react-router.js
- But really, what is a JavaScript mock? https://blog.kentcdodds.com/but-really-what-is-a-javascript-mock-10d060966f7d