Testing is a double-edged sword. On one hand, having a solid test suite makes code easier to refactor, and gives confidence that it works the way it should. On the other hand, tests must be written and maintained. They have a cost, like any other code.
In a magical world, we could write our code, and then verify that it works with very little extra code.
Snapshot tests come close to offering this dreamy future. In this tutorial, we will go over what snapshot tests are and how to start using them with React.
What is a Snapshot Test?
A snapshot test verifies that a piece of functionality works the same as it did when the snapshot was created. It’s like taking a picture of an app in a certain state, and then being able to automatically verify that nothing has changed.
... read the whole story at daveceddia.com.