Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arthurgousset/jest
✨ Jest cheat sheet
https://github.com/arthurgousset/jest
Last synced: 18 days ago
JSON representation
✨ Jest cheat sheet
- Host: GitHub
- URL: https://github.com/arthurgousset/jest
- Owner: arthurgousset
- Created: 2023-11-01T14:36:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-01T15:16:16.000Z (about 1 year ago)
- Last Synced: 2024-10-14T01:13:20.376Z (about 1 month ago)
- Homepage:
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Snapshot testing
> Snapshot tests are a very useful tool whenever you want to make sure your UI does not change
> unexpectedly.
>
> A typical snapshot test case renders a UI component, takes a snapshot, then compares it to a
> reference snapshot file stored alongside the test. The test will fail if the two snapshots do
> not match: either the change is unexpected, or the reference snapshot needs to be updated to the
> new version of the UI component.Source: [jestjs.io](https://jestjs.io/docs/snapshot-testing)
Came across this in a `viem` test using `toMatchInlineSnapshot()`.
```ts
test("gasPrice", async () => {
expect(
await signTransaction(walletClient, {
account: privateKeyToAccount(sourceAccount.privateKey),
...baseLegacy,
gasPrice: parseGwei("20"),
})
).toMatchInlineSnapshot(
'"0xf8518203118504a817c800825208808080259f672886c0db7d3a2710b5bb8b64fd516ff4fede94f34e76b22f451e5ff92ecfa0627283bbafb0600cd997c8dbfa6f4173c5376e2c4c57967541e171fb110b6d64"'
);
});
```See comment in [code review](https://github.com/clabs-co/viem/pull/6#discussion_r1378906295).