@@ -12,7 +12,15 @@ describe('script warmup', () => {
12
12
head,
13
13
} )
14
14
const ssr = await renderSSRHead ( head )
15
- expect ( ssr . headTags ) . toMatchInlineSnapshot ( `"<link fetchpriority="low" as="script" href="/preload.js" rel="preload">"` )
15
+ expect ( ssr . headTags . split ( ' ' ) . sort ( ) ) . toMatchInlineSnapshot ( `
16
+ [
17
+ "<link",
18
+ "as="script"",
19
+ "fetchpriority="low"",
20
+ "href="/preload.js"",
21
+ "rel="preload">",
22
+ ]
23
+ ` )
16
24
script . remove ( )
17
25
} )
18
26
it ( 'preload relative' , async ( ) => {
@@ -25,7 +33,15 @@ describe('script warmup', () => {
25
33
head,
26
34
} )
27
35
const ssr = await renderSSRHead ( head )
28
- expect ( ssr . headTags ) . toMatchInlineSnapshot ( `"<link fetchpriority="low" as="script" href="/preload.js" rel="preload">"` )
36
+ expect ( ssr . headTags . split ( ' ' ) . sort ( ) ) . toMatchInlineSnapshot ( `
37
+ [
38
+ "<link",
39
+ "as="script"",
40
+ "fetchpriority="low"",
41
+ "href="/preload.js"",
42
+ "rel="preload">",
43
+ ]
44
+ ` )
29
45
script . remove ( )
30
46
} )
31
47
it ( 'preconnect relative' , async ( ) => {
@@ -51,7 +67,16 @@ describe('script warmup', () => {
51
67
head,
52
68
} )
53
69
const ssr = await renderSSRHead ( head )
54
- expect ( ssr . headTags ) . toMatchInlineSnapshot ( `"<link fetchpriority="low" crossorigin="anonymous" referrerpolicy="no-referrer" href="https:example.com" rel="preconnect">"` )
70
+ expect ( ssr . headTags . split ( ' ' ) . sort ( ) ) . toMatchInlineSnapshot ( `
71
+ [
72
+ "<link",
73
+ "crossorigin="anonymous"",
74
+ "fetchpriority="low"",
75
+ "href="https:example.com"",
76
+ "referrerpolicy="no-referrer"",
77
+ "rel="preconnect">",
78
+ ]
79
+ ` )
55
80
script . remove ( )
56
81
} )
57
82
it ( 'preload abs' , async ( ) => {
@@ -64,7 +89,17 @@ describe('script warmup', () => {
64
89
head,
65
90
} )
66
91
const ssr = await renderSSRHead ( head )
67
- expect ( ssr . headTags ) . toMatchInlineSnapshot ( `"<link fetchpriority="low" as="script" crossorigin="anonymous" referrerpolicy="no-referrer" href="https://example.com/preload.js" rel="preload">"` )
92
+ expect ( ssr . headTags . split ( ' ' ) . sort ( ) ) . toMatchInlineSnapshot ( `
93
+ [
94
+ "<link",
95
+ "as="script"",
96
+ "crossorigin="anonymous"",
97
+ "fetchpriority="low"",
98
+ "href="https://example.com/preload.js"",
99
+ "referrerpolicy="no-referrer"",
100
+ "rel="preload">",
101
+ ]
102
+ ` )
68
103
script . remove ( )
69
104
} )
70
105
it ( 'respects useScript privacy controls' , async ( ) => {
@@ -77,7 +112,17 @@ describe('script warmup', () => {
77
112
head,
78
113
} )
79
114
const ssr = await renderSSRHead ( head )
80
- expect ( ssr . headTags ) . toMatchInlineSnapshot ( `"<link fetchpriority="low" as="script" crossorigin="use-credentials" referrerpolicy="no-referrer-when-downgrade" href="https://s.kk-resources.com/leadtag.js" rel="preload">"` )
115
+ expect ( ssr . headTags . split ( ' ' ) . sort ( ) ) . toMatchInlineSnapshot ( `
116
+ [
117
+ "<link",
118
+ "as="script"",
119
+ "crossorigin="use-credentials"",
120
+ "fetchpriority="low"",
121
+ "href="https://s.kk-resources.com/leadtag.js"",
122
+ "referrerpolicy="no-referrer-when-downgrade"",
123
+ "rel="preload">",
124
+ ]
125
+ ` )
81
126
script . remove ( )
82
127
} )
83
128
it ( 'respects useScript privacy controls - #293' , async ( ) => {
@@ -90,7 +135,16 @@ describe('script warmup', () => {
90
135
head,
91
136
} )
92
137
const ssr = await renderSSRHead ( head )
93
- expect ( ssr . headTags ) . toMatchInlineSnapshot ( `"<link fetchpriority="low" as="script" referrerpolicy="no-referrer" href="https://s.kk-resources.com/leadtag.js" rel="preload">"` )
138
+ expect ( ssr . headTags . split ( ' ' ) . sort ( ) ) . toMatchInlineSnapshot ( `
139
+ [
140
+ "<link",
141
+ "as="script"",
142
+ "fetchpriority="low"",
143
+ "href="https://s.kk-resources.com/leadtag.js"",
144
+ "referrerpolicy="no-referrer"",
145
+ "rel="preload">",
146
+ ]
147
+ ` )
94
148
script . remove ( )
95
149
} )
96
150
} )
0 commit comments