styled-componentsを使う際テストでは、jest-styled-componentsは便利です。
styleの変化を検知することができます。
- Snapshot
+ Received
+.c0 {
+ color: green;
+}
+
<button
- className="sc-bdVaJa rOCEJ"
+ className="c0"
/>
v3では、このスナップショットを取るために、toMatchStyledComponentsSnapshot
が必要でしたが、
v4以降は、このAPIが削除されtoMatchSnapshot
でスナップショットするように変更されました。