'How to ignore style changes in styled-components during snapshot tests in jest
Assume i have a simple component I wish to snapshot test:
const Component = styled.div`{
color: red;
}`
My snapshot test wishes to ensure that the div renders, but the styling is not important. So if I did a snapshot test on this Component, and i changed color from red to blue, and a new classname is generated, it would not fail the snapshot test.
In short, is there any way I can either ignore className in snapshot tests, or tell styled-components to generate static class names to be deterministic in tests?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
