We need to talk.. about testing!
Submitted by Aakash N S (@aakashns) on Friday, 30 March 2018
I’ve been using React for almost 5 years, but I hadn’t written a single test till quite recently. I always felt that testing is difficult, time consuming and mostly unnecessary. But after trying it, I realized that it’s actually really really easy to test React & Redux applications, and requires almost zero setup to get started. It’s totally worth the investment!
Besides, it doesn’t have to be “all or nothing”. You can test specific parts of application logic in isolation, and save yourself from hours of mindless debugging. Moreover, writing tests also acts as a forcing function to write modular, encapsulated and testable code.
This talk should be accessible to most developers familiar with React JS and Redux.
I plan to spend about 5 minutes talking about each of the following topics:
- Why, when and what to test?
- Testing React+Redux apps
- Writing testable code
- Testing Redux reducers and action creators
- Testing presentational components using snapshots
- Mocking network requests and testing asynchronous code
- Putting it all together
- The talk will involve some live coding and testing.
- React JS
I’ve been using React JS since 2013, and React Native since its initial release, so I’m well versed with the tools, libraries, community best practices etc. As a part of my consulting and freelance work, I have helped several teams adopt React JS and related tools & technologies (React Router, Redux, Webpack etc.) for large enterprise-scale applications.
I’ve also created several open source projects related to React JS and React Native, the most popular of which is ‘react-native-dialogs’ which has 400+ stars on Github and is used by 2500+ developers every month (more at npmjs.com/~aakashns ) . Apart from this, I also blog frequently about React/React Native and related topics at medium.com/@aakashns .