April 2020
Intermediate to advanced
716 pages
18h 55m
English
The first time this test is run, we will provide it with the values required to generate the correct snapshot of the Post view. The correct snapshot for this test case will contain the delete button when the user._id of the auth object is equal to the postedBy value of the post object. This snapshot is generated when the test is run for the first time, and it will be used for comparison in future test executions.
This kind of snapshot testing in Jest basically records snapshots of rendered component structures to compare them to future renderings. When the recorded snapshot and the current rendering don't match, the test fails, indicating that something has changed. In the next section, we will ...
Read now
Unlock full access