Skip to content

Commit 0601e00

Browse files
committed
test: remove quotes (and annoying escaping) from snapshots
1 parent f553c65 commit 0601e00

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/__tests__/index.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import remarkEmbedder from '@remark-embedder/core'
22
import remark from 'remark'
33
import html from 'remark-html'
44

5-
import CodeSandboxTransformer from '..'
5+
import CodeSandboxTransformer from '../'
6+
7+
// this removes the quotes around strings...
8+
const unquoteSerializer = {
9+
serialize: (val: string) => val.trim(),
10+
test: (val: unknown) => typeof val === 'string',
11+
}
12+
expect.addSnapshotSerializer(unquoteSerializer)
613

714
test('smoke test', async () => {
815
const result = await remark()
@@ -19,12 +26,7 @@ https://codesandbox.io/s/css-variables-vs-themeprovider-df90h
1926
)
2027

2128
expect(result.toString()).toMatchInlineSnapshot(`
22-
"<p>This is a CodeSandbox:</p>
23-
<iframe src=\\"https://codesandbox.io/embed/css-variables-vs-themeprovider-df90h\\" style=\\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\\" allow=\\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\\" sandbox=\\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\\"></iframe>
24-
"
29+
<p>This is a CodeSandbox:</p>
30+
<iframe src="https://codesandbox.io/embed/css-variables-vs-themeprovider-df90h" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
2531
`)
2632
})
27-
28-
/*
29-
eslint @typescript-eslint/no-unsafe-assignment: "off"
30-
*/

0 commit comments

Comments
 (0)