@@ -12,7 +12,15 @@ describe('script warmup', () => {
1212 head,
1313 } )
1414 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+ ` )
1624 script . remove ( )
1725 } )
1826 it ( 'preload relative' , async ( ) => {
@@ -25,7 +33,15 @@ describe('script warmup', () => {
2533 head,
2634 } )
2735 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+ ` )
2945 script . remove ( )
3046 } )
3147 it ( 'preconnect relative' , async ( ) => {
@@ -51,7 +67,16 @@ describe('script warmup', () => {
5167 head,
5268 } )
5369 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+ ` )
5580 script . remove ( )
5681 } )
5782 it ( 'preload abs' , async ( ) => {
@@ -64,7 +89,17 @@ describe('script warmup', () => {
6489 head,
6590 } )
6691 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+ ` )
68103 script . remove ( )
69104 } )
70105 it ( 'respects useScript privacy controls' , async ( ) => {
@@ -77,7 +112,17 @@ describe('script warmup', () => {
77112 head,
78113 } )
79114 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+ ` )
81126 script . remove ( )
82127 } )
83128 it ( 'respects useScript privacy controls - #293' , async ( ) => {
@@ -90,7 +135,16 @@ describe('script warmup', () => {
90135 head,
91136 } )
92137 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+ ` )
94148 script . remove ( )
95149 } )
96150} )
0 commit comments