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.

We use JavaScript libraries, React, and Redux, to construct fancy, interactive data analysis tools that bring our product pricing, placement, and promotion data to life on our Dashboard application. React is a component-based library used for building interactive user interfaces, while Redux is used to help manage application state.

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:

  • Jest, developed by Facebook, is an out of the box, configuration free JavaScript unit testing framework that acts as a test runner, assertion and mocking library
  • Enzyme, created by Airbnb, is a JavaScript testing utility that makes it easier to interact with elements, manipulate and traverse your React Components’ output
  • 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

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 info@gapintelligence.com or call us at 619-574-1100 to learn more.