snapshot jest code example
Example 1: jest update snapshot
jest --updateSnapshot
Copy
Example 2: update snapshot jest
npx jest --u
Example 3: snapshot testing
import React from 'react';
import Link from '../Link.react';
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer
.create(Facebook)
.toJSON();
expect(tree).toMatchSnapshot();
});
Example 4: snapshot testing
exports[`renders correctly 1`] = `
Facebook
`;