Using Snapshots

Learn to use snapshot testing in this lesson.

Understanding snapshot testing

A snapshot test defines the result of a test and stores the result in a snapshot the first time the test is executed. On subsequent test executions, the result is compared against the baseline snapshot, and if there is a difference, the test fails.

Snapshots can be useful when checking result objects or arrays. They can also be used to check portions of the DOM.

Checking for unexpected changes in objects

This lesson’s project is similar to previous lessons. We have functions to get a person and search for people. There is a happy path test for each function as well, which passes.

A copy of the starter project ...

Access this course and 1400+ top-rated courses and projects.