Writing Snapshot Tests For React Components With Jest
In this tutorial, we will be looking at what snapshot tests are and how we can use snapshot testing to ensure our User Interface does not change without the team knowing about it.
To get started, you will need to familiarize yourself with the following
NodeJS - A JavaScript runtime built on Chrome's V8 JavaScript engine.
React - A JavaScript library for building delightful UI by Facebook
Jest - A JavaScript testing framework by Facebook.
What Is Snapshot Testing?
Unlike strict Test Driven Development where the standard practice is to write failing tests first then write the code to make the tests pass, Snapshot testing takes a different approach.
To write a snapshot test, you first get your code working, say, a React component, then generate a snapshot of it's expected output given certai...