-
-
Notifications
You must be signed in to change notification settings - Fork 608
/
Copy pathgetUrl.test.js
54 lines (50 loc) · 1.86 KB
/
getUrl.test.js
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
44
45
46
47
48
49
50
51
52
53
54
const getUrl = require('../../src/runtime/getUrl');
describe('escape', () => {
it('should escape url', () => {
expect(getUrl(true)).toMatchSnapshot();
expect(getUrl('image.png')).toMatchSnapshot();
expect(getUrl('"image.png"')).toMatchSnapshot();
expect(getUrl("'image.png'")).toMatchSnapshot();
expect(getUrl('image other.png')).toMatchSnapshot();
expect(getUrl('"image other.png"')).toMatchSnapshot();
expect(getUrl("'image other.png'")).toMatchSnapshot();
expect(getUrl('image"other.png')).toMatchSnapshot();
expect(getUrl('image\nother.png')).toMatchSnapshot();
expect(getUrl('image.png', true)).toMatchSnapshot();
expect(getUrl("'image other.png'", true)).toMatchSnapshot();
expect(getUrl('"image other.png"', true)).toMatchSnapshot();
expect(
getUrl({ default: 'image.png', __esModule: true })
).toMatchSnapshot();
expect(
getUrl({ default: "'image.png'", __esModule: true })
).toMatchSnapshot();
expect(
getUrl({ default: '"image.png"', __esModule: true })
).toMatchSnapshot();
expect(
getUrl({ default: 'image other.png', __esModule: true })
).toMatchSnapshot();
expect(
getUrl({ default: '"image other.png"', __esModule: true })
).toMatchSnapshot();
expect(
getUrl({ default: "'image other.png'", __esModule: true })
).toMatchSnapshot();
expect(
getUrl({ default: 'image"other.png', __esModule: true })
).toMatchSnapshot();
expect(
getUrl({ default: 'image\nother.png', __esModule: true })
).toMatchSnapshot();
expect(
getUrl({ default: 'image.png', __esModule: true }, true)
).toMatchSnapshot();
expect(
getUrl({ default: "'image.png'", __esModule: true }, true)
).toMatchSnapshot();
expect(
getUrl({ default: '"image.png"', __esModule: true }, true)
).toMatchSnapshot();
});
});