At gap intelligence we have over ten different applications that help us provide GFD (Great Freaking Data) to our clients in creative and useful ways. The languages and frameworks we use to build and maintain these systems vary depending on the problem we need to solve.
In order to ensure our customers enjoy high-quality, reliable software, we put great emphasis on having a solid suite of automated unit and integration tests. Testing what a React component renders, the props it receives, the state it holds, etc. gives us confidence that we are not introducing bugs when refactoring or adding new features.
These are the tools that we use most for testing:
- Chai provides natural language assertions with an expressive and readable style. Jest provides much of the same functionality that Chai does, however we prefer the sugary syntax of Chai’s chainable getters
- Last but not least, Sinon gives us standalone test spies, stubs and mocks that allow us to simulate and observe the behaviors of our components
These are excellent, open-source tools but boy it can be a lot more to learn on top of mastering the React framework itself. To help me keep all the different testing frameworks, libraries, and tools straight, I have made a cheat sheet for myself that I’d like to share with you. While by no means an exhaustive list, it is a good representation of the most common assertions, matchers, and mock functions that we use. If you enjoy this, check out gap intelligence’s other one page sheets.
One Page React Testing Cheat Sheet
For more than 16 years, gap intelligence has served manufacturers and sellers by providing world-class services monitoring, reporting, and analyzing the 4Ps: prices, promotions, placements, and products. Email us at email@example.com or call us at 619-574-1100 to learn more.