Pattern: String interpolation in snapshot
Issue: -
Using string interpolation in snapshots prevents them from being properly updated. Property matchers should be used instead to handle dynamic values in snapshots.
Example of incorrect code:
expect(value).toMatchInlineSnapshot(`
Object {
property: ${interpolated}
}
`);
expect(error).toThrowErrorMatchingInlineSnapshot(`${message}`);
Example of correct code:
expect(value).toMatchInlineSnapshot({
property: expect.any(String)
}, `
Object {
property: Any<String>
}
`);