@@ -2,8 +2,7 @@ import { assert, test } from 'vitest';
2
2
import {
3
3
getClientDataPath ,
4
4
getClientNavPath ,
5
- shouldPrefetchData ,
6
- shouldPrefetchSymbols ,
5
+ shouldPreload ,
7
6
isSameOrigin ,
8
7
isSameOriginDifferentPathname ,
9
8
isSamePath ,
@@ -189,94 +188,45 @@ test(`isSameOrigin`, () => {
189
188
} ) ;
190
189
} ) ;
191
190
192
- test ( 'missing clientNavPath' , ( ) => {
193
- const clientNavPath = null ;
194
- const currentLoc = new URL ( 'https://qwik.dev/contact' ) ;
195
- assert . equal ( shouldPrefetchData ( clientNavPath , { url : currentLoc } ) , false ) ;
196
- } ) ;
197
-
198
- test ( 'path and current path the same, has different querystring and hash' , ( ) => {
199
- const clientNavPath = '/about?qs#hash' ;
200
- const currentLoc = new URL ( 'https://qwik.dev/about' ) ;
201
- assert . equal ( shouldPrefetchData ( clientNavPath , { url : currentLoc } ) , true ) ;
202
- } ) ;
203
-
204
- test ( 'path and current path the same, querystring the same' , ( ) => {
205
- const clientNavPath = '/about?qs' ;
206
- const currentLoc = new URL ( 'https://qwik.dev/about?qs' ) ;
207
- assert . equal ( shouldPrefetchData ( clientNavPath , { url : currentLoc } ) , false ) ;
208
- } ) ;
209
-
210
- test ( 'path and current path the same' , ( ) => {
211
- const clientNavPath = '/about' ;
212
- const currentLoc = new URL ( 'https://qwik.dev/about' ) ;
213
- assert . equal ( shouldPrefetchData ( clientNavPath , { url : currentLoc } ) , false ) ;
214
- } ) ;
215
-
216
- test ( 'path and current path the same, different trailing slash' , ( ) => {
217
- const clientNavPath = '/about/' ;
218
- const currentLoc = new URL ( 'https://qwik.dev/about' ) ;
219
- assert . equal ( shouldPrefetchData ( clientNavPath , { url : currentLoc } ) , false ) ;
220
- } ) ;
221
-
222
- test ( 'valid prefetchUrl, has querystring and hash' , ( ) => {
223
- const clientNavPath = '/about?qs#hash' ;
224
- const currentLoc = new URL ( 'https://qwik.dev/contact' ) ;
225
- assert . equal ( shouldPrefetchData ( clientNavPath , { url : currentLoc } ) , true ) ;
226
- } ) ;
227
-
228
- test ( 'valid prefetchUrl, trailing slash' , ( ) => {
229
- const clientNavPath = '/about/' ;
230
- const currentLoc = new URL ( 'https://qwik.dev/contact' ) ;
231
- assert . equal ( shouldPrefetchData ( clientNavPath , { url : currentLoc } ) , true ) ;
232
- } ) ;
233
-
234
- test ( 'valid prefetchUrl' , ( ) => {
235
- const clientNavPath = '/about' ;
236
- const currentLoc = new URL ( 'https://qwik.dev/contact' ) ;
237
- assert . equal ( shouldPrefetchData ( clientNavPath , { url : currentLoc } ) , true ) ;
238
- } ) ;
239
-
240
- // shouldPrefetchSymbols.
241
191
// ======================
242
192
test ( 'missing clientNavPath' , ( ) => {
243
193
const clientNavPath = null ;
244
194
const currentLoc = new URL ( 'https://qwik.dev/contact' ) ;
245
- assert . equal ( shouldPrefetchSymbols ( clientNavPath , { url : currentLoc } ) , false ) ;
195
+ assert . equal ( shouldPreload ( clientNavPath , { url : currentLoc } ) , false ) ;
246
196
} ) ;
247
197
248
198
test ( 'path and current path the same, has different querystring and hash' , ( ) => {
249
199
const clientNavPath = '/about?qs#hash' ;
250
200
const currentLoc = new URL ( 'https://qwik.dev/about' ) ;
251
- assert . equal ( shouldPrefetchSymbols ( clientNavPath , { url : currentLoc } ) , false ) ;
201
+ assert . equal ( shouldPreload ( clientNavPath , { url : currentLoc } ) , false ) ;
252
202
} ) ;
253
203
254
204
test ( 'path and current path the same, different trailing slash' , ( ) => {
255
205
const clientNavPath = '/about/' ;
256
206
const currentLoc = new URL ( 'https://qwik.dev/about' ) ;
257
- assert . equal ( shouldPrefetchSymbols ( clientNavPath , { url : currentLoc } ) , false ) ;
207
+ assert . equal ( shouldPreload ( clientNavPath , { url : currentLoc } ) , false ) ;
258
208
} ) ;
259
209
260
210
test ( 'path and current path the same' , ( ) => {
261
211
const clientNavPath = '/about' ;
262
212
const currentLoc = new URL ( 'https://qwik.dev/about' ) ;
263
- assert . equal ( shouldPrefetchSymbols ( clientNavPath , { url : currentLoc } ) , false ) ;
213
+ assert . equal ( shouldPreload ( clientNavPath , { url : currentLoc } ) , false ) ;
264
214
} ) ;
265
215
266
216
test ( 'valid prefetchUrl, has querystring and hash' , ( ) => {
267
217
const clientNavPath = '/about?qs#hash' ;
268
218
const currentLoc = new URL ( 'https://qwik.dev/contact' ) ;
269
- assert . equal ( shouldPrefetchSymbols ( clientNavPath , { url : currentLoc } ) , true ) ;
219
+ assert . equal ( shouldPreload ( clientNavPath , { url : currentLoc } ) , true ) ;
270
220
} ) ;
271
221
272
222
test ( 'valid prefetchUrl, trailing slash' , ( ) => {
273
223
const clientNavPath = '/about/' ;
274
224
const currentLoc = new URL ( 'https://qwik.dev/contact' ) ;
275
- assert . equal ( shouldPrefetchSymbols ( clientNavPath , { url : currentLoc } ) , true ) ;
225
+ assert . equal ( shouldPreload ( clientNavPath , { url : currentLoc } ) , true ) ;
276
226
} ) ;
277
227
278
228
test ( 'valid prefetchUrl' , ( ) => {
279
229
const clientNavPath = '/about' ;
280
230
const currentLoc = new URL ( 'https://qwik.dev/contact' ) ;
281
- assert . equal ( shouldPrefetchSymbols ( clientNavPath , { url : currentLoc } ) , true ) ;
231
+ assert . equal ( shouldPreload ( clientNavPath , { url : currentLoc } ) , true ) ;
282
232
} ) ;
0 commit comments