-
Notifications
You must be signed in to change notification settings - Fork 235
/
Copy pathindex.test.tsx
63 lines (55 loc) · 1.94 KB
/
index.test.tsx
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
55
56
57
58
59
60
61
62
63
import React from 'react';
import serialiseForScript from '#app/lib/utilities/serialiseForScript';
import removeDataReactHelmetAttribute from '.';
describe('removeDataReactHelmetAttribute', () => {
it('removes data-react-helmet from meta tags', () => {
const metaTags = [
<meta data-react-helmet="true" name="name1" content="content1" />,
<meta data-react-helmet="true" name="name2" content="content2" />,
];
expect(removeDataReactHelmetAttribute(metaTags)).toStrictEqual([
<meta name="name1" content="content1" />,
<meta name="name2" content="content2" />,
]);
});
it('removes data-react-helmet from link tags', () => {
const linkTags = [
<link
data-react-helmet="true"
rel="canonical"
href="https://www.bbc.com/pidgin"
/>,
<link
data-react-helmet="true"
rel="icon"
href="https://www.bbc.com/pidgin"
/>,
];
expect(removeDataReactHelmetAttribute(linkTags)).toStrictEqual([
<link rel="canonical" href="https://www.bbc.com/pidgin" />,
<link rel="icon" href="https://www.bbc.com/pidgin" />,
]);
});
it('removes data-react-helmet from script tags', () => {
const scriptTags = [
<script data-react-helmet="true" type="text/javascript">
console.log(`Hello World`);
</script>,
<script data-react-helmet="true" type="application/ld+json">
{serialiseForScript({ key: 'value' })}
</script>,
];
expect(removeDataReactHelmetAttribute(scriptTags)).toStrictEqual([
<script type="text/javascript">console.log(`Hello World`);</script>,
<script type="application/ld+json">
{serialiseForScript({ key: 'value' })}
</script>,
]);
});
it('removes data-react-helmet from title tag', () => {
const title = <title data-react-helmet="true">Title</title>;
expect(removeDataReactHelmetAttribute(title)).toStrictEqual(
<title>Title</title>,
);
});
});