forked from vuejs/vitepress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snippet.test.ts
43 lines (40 loc) · 972 Bytes
/
snippet.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { dedent } from 'node/markdown/plugins/snippet'
describe('node/markdown/plugins/snippet', () => {
describe('dedent', () => {
test("when 0-level is minimal, it doesn't remove spaces", () => {
expect(
dedent(
[
//
'fn main() {',
' println!("Hello");',
'}'
].join('\n')
)
).toMatchInlineSnapshot(`
"fn main() {
println!(\\"Hello\\");
}"
`)
})
test('when 4-level is minimal, it removes 4 spaces', () => {
expect(
dedent(
[
//
' let a = {',
' Some(42)',
' };'
].join('\n')
)
).toMatchInlineSnapshot(`
"let a = {
Some(42)
};"
`)
})
test('when the only 1 line is passed, it is de-dented', () => {
expect(dedent(' let a = 42;')).toEqual('let a = 42;')
})
})
})