Snapshot Testing
Snapshot tests provide a way to write tests for fast-changing pieces of code without keeping the assertion data inline with the test. They store snapshots instead.
Changes to a snapshot reflect changes to the output, which is quite useful for code reviews.
For example, we can add a snapshot test to the PostList.test.js file:
// imports and tests
test('Post List renders correctly', () => {
const wrapper = mount(PostList, {
propsData: {
posts: [
{
title: 'Title 1',
description: 'Description 1',
tags: ['react', 'vue']
},
...