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'] Â Â Â Â Â Â Â Â }, Â Â Â Â Â Â Â ...