@@ -2,7 +2,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, vi, type MockInstance
22import { testWithEffect as test } from "$test/testWithEffect.svelte.js" ;
33import { ALL_HASHES , ROUTING_UNIVERSES } from "$test/test-utils.js" ;
44import { init } from "$lib/init.js" ;
5- import type { Hash , PatternRouteInfo , RedirectedRouteInfo } from "$lib/types.js" ;
5+ import type { Hash , RouteInfo , RedirectedRouteInfo } from "$lib/types.js" ;
66import { resolveHashValue } from "./kernel/resolveHashValue.js" ;
77import { Redirector } from "./Redirector.svelte.js" ;
88import { location } from "./kernel/Location.js" ;
@@ -48,27 +48,27 @@ ROUTING_UNIVERSES.forEach((universe) => {
4848 } ) [ ] = [
4949 {
5050 triggerUrl : '/old/path' ,
51- pattern : '/old/path' ,
51+ path : '/old/path' ,
5252 href : '/new/path' ,
5353 expectedPath : '/new/path' ,
5454 text : "Static pattern; static href"
5555 } ,
5656 {
57- pattern : '/old-path/:id' ,
57+ path : '/old-path/:id' ,
5858 triggerUrl : '/old-path/123' ,
5959 expectedPath : '/new-path/123' ,
6060 href : ( rp ) => `/new-path/${ rp ?. id } ` ,
6161 text : "Parameterized pattern; dynamic href"
6262 } ,
6363 {
64- pattern : '/old-path/*' ,
64+ path : '/old-path/*' ,
6565 triggerUrl : '/old-path/any/number/of/segments' ,
6666 expectedPath : '/new-path/any/number/of/segments' ,
6767 href : ( rp ) => `/new-path${ rp ?. rest } ` ,
6868 text : "Rest parameter; dynamic href"
6969 } ,
7070 {
71- pattern : '/conditional/:id' ,
71+ path : '/conditional/:id' ,
7272 triggerUrl : '/conditional/123' ,
7373 expectedPath : '/allowed/123' ,
7474 href : ( rp ) => `/allowed/${ rp ?. id } ` ,
@@ -104,7 +104,7 @@ ROUTING_UNIVERSES.forEach((universe) => {
104104
105105 // Act.
106106 redirector . redirections . push ( {
107- pattern : '/old-path' ,
107+ path : '/old-path' ,
108108 href : '/new-path' ,
109109 goTo : true ,
110110 } ) ;
@@ -123,7 +123,7 @@ ROUTING_UNIVERSES.forEach((universe) => {
123123
124124 // Act.
125125 redirector . redirections . push ( {
126- pattern : '/conditional/:id' ,
126+ path : '/conditional/:id' ,
127127 href : '/not-allowed' ,
128128 and : ( rp ) => ( rp ?. id as number ) > 100 ,
129129 } ) ;
@@ -143,11 +143,11 @@ ROUTING_UNIVERSES.forEach((universe) => {
143143 // Act.
144144 redirector . redirections . push (
145145 {
146- pattern : '/multi/*' ,
146+ path : '/multi/*' ,
147147 href : '/first-match' ,
148148 } ,
149149 {
150- pattern : '/multi/test' ,
150+ path : '/multi/test' ,
151151 href : '/second-match' ,
152152 }
153153 ) ;
@@ -166,7 +166,7 @@ ROUTING_UNIVERSES.forEach((universe) => {
166166
167167 // Act.
168168 redirector . redirections . push ( {
169- pattern : '/test-replace' ,
169+ path : '/test-replace' ,
170170 href : '/replaced' ,
171171 } ) ;
172172 flushSync ( ) ;
@@ -185,7 +185,7 @@ ROUTING_UNIVERSES.forEach((universe) => {
185185
186186 // Act.
187187 redirector . redirections . push ( {
188- pattern : '/with-options' ,
188+ path : '/with-options' ,
189189 href : '/target' ,
190190 options : { preserveQuery : true , state : { custom : 'data' } }
191191 } ) ;
@@ -205,15 +205,15 @@ ROUTING_UNIVERSES.forEach((universe) => {
205205
206206 // Add initial redirection that won't match
207207 redirector . redirections . push ( {
208- pattern : '/different-path' ,
208+ path : '/different-path' ,
209209 href : '/not-relevant'
210210 } ) ;
211211 flushSync ( ) ;
212212 navigateSpy . mockClear ( ) ;
213213
214214 // Act.
215215 redirector . redirections . push ( {
216- pattern : '/test-reactivity' ,
216+ path : '/test-reactivity' ,
217217 href : '/should-redirect'
218218 } ) ;
219219 flushSync ( ) ;
@@ -227,14 +227,14 @@ ROUTING_UNIVERSES.forEach((universe) => {
227227 location . navigate ( '/test-reactivity' , { hash : universe . hash } ) ;
228228 const redirector = new Redirector ( universe . hash ) ;
229229 redirector . redirections . push ( {
230- pattern : '/different-path' ,
230+ path : '/different-path' ,
231231 href : '/punch-line'
232232 } ) ;
233233 flushSync ( ) ;
234234 navigateSpy . mockClear ( ) ;
235235
236236 // Act.
237- ( redirector . redirections [ 0 ] as PatternRouteInfo ) . pattern = '/test-reactivity' ;
237+ redirector . redirections [ 0 ] . path = '/test-reactivity' ;
238238 flushSync ( ) ;
239239
240240 // Assert.
@@ -251,7 +251,7 @@ ROUTING_UNIVERSES.forEach((universe) => {
251251 // Act.
252252 const redirector = new Redirector ( universe . hash , { replace : false } ) ;
253253 redirector . redirections . push ( {
254- pattern : '/explicit-hash' ,
254+ path : '/explicit-hash' ,
255255 href : '/redirected-explicit'
256256 } ) ;
257257 flushSync ( ) ;
@@ -273,7 +273,7 @@ ROUTING_UNIVERSES.forEach((universe) => {
273273 // Act.
274274 const redirector = new Redirector ( universe . hash , { replace : true } ) ;
275275 redirector . redirections . push ( {
276- pattern : '/hash-resolution-test' ,
276+ path : '/hash-resolution-test' ,
277277 href : '/hash-resolved'
278278 } ) ;
279279 flushSync ( ) ;
@@ -299,7 +299,7 @@ ROUTING_UNIVERSES.forEach((universe) => {
299299 // Act.
300300 const redirector = new Redirector ( { replace : false } ) ;
301301 redirector . redirections . push ( {
302- pattern : '/default-hash' ,
302+ path : '/default-hash' ,
303303 href : '/redirected-default'
304304 } ) ;
305305 flushSync ( ) ;
@@ -319,7 +319,7 @@ ROUTING_UNIVERSES.forEach((universe) => {
319319 // Act.
320320 const redirector = new Redirector ( { } ) ; // Empty options object
321321 redirector . redirections . push ( {
322- pattern : '/minimal-options' ,
322+ path : '/minimal-options' ,
323323 href : '/redirected-minimal'
324324 } ) ;
325325 flushSync ( ) ;
@@ -373,7 +373,7 @@ describe("Options-Only Constructor with Matching Library Defaults", () => {
373373 // Act.
374374 const redirector = new Redirector ( { replace : false } ) ;
375375 redirector . redirections . push ( {
376- pattern : '/hash-default-test' ,
376+ path : '/hash-default-test' ,
377377 href : '/hash-redirected'
378378 } ) ;
379379 flushSync ( ) ;
@@ -414,7 +414,7 @@ describe("Options-Only Constructor with Matching Library Defaults", () => {
414414 // Act.
415415 const redirector = new Redirector ( { replace : false } ) ;
416416 redirector . redirections . push ( {
417- pattern : '/multi-hash-default-test' ,
417+ path : '/multi-hash-default-test' ,
418418 href : '/multi-hash-redirected'
419419 } ) ;
420420 flushSync ( ) ;
@@ -461,7 +461,7 @@ describe("Cross-universe Redirection", () => {
461461
462462 // Act.
463463 redirector . redirections . push ( {
464- pattern : '/old-path-route' ,
464+ path : '/old-path-route' ,
465465 href : '/new-hash-route' ,
466466 options : { hash : true }
467467 } ) ;
@@ -482,7 +482,7 @@ describe("Cross-universe Redirection", () => {
482482
483483 // Act.
484484 redirector . redirections . push ( {
485- pattern : '/old-hash-route' ,
485+ path : '/old-hash-route' ,
486486 href : '/new-path-route' ,
487487 options : { hash : false } // Target path universe
488488 } ) ;
@@ -555,7 +555,7 @@ describe("Cross-universe Redirection", () => {
555555
556556 // Act.
557557 redirector . redirections . push ( {
558- pattern : '/old-path-route' ,
558+ path : '/old-path-route' ,
559559 href : '/new-hash-route' ,
560560 options : { hash : tc . destinationHash }
561561 } ) ;
0 commit comments