Running and checking the test

In the code that we just added to the post.test.js, the dummy auth object and post object refer to the same user, thus running this test in the command line will prompt Jest to generate a snapshot that will contain the delete option and also pass the test.

To run the test, go into the project folder from the command line:

npm run test

The test output will show that the test passed:

The recorded snapshot that is generated, when this test runs successfully for the first time, is added automatically to a _snapshots_ folder in the tests folder. This snapshot represents the state where the delete button is rendered ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.