.toMatchSnapshot(propertyMatchers, snapshotName)

This ensures that a value matches the most recent snapshot. Check out the Snapshot Testing guide for more information.

The optional propertyMatchers argument allows you to specify asymmetric matchers which are verified instead of the exact values. Any value will be matched exactly if not provided as a matcher.

The last argument allows you option to specify a snapshot name. Otherwise, the name is inferred from the test.

Note: While snapshot testing is most commonly used with React components, any serializable value can be used as a snapshot.