File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
packages/router/src/experimental/route-resolver/matchers Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -237,8 +237,17 @@ describe('MatcherPatternPathDynamic', () => {
237237 expect ( ( ) => pattern . build ( { teamId : [ ] } ) ) . toThrow ( )
238238 } )
239239
240- it . todo ( 'catch all route' , ( ) => {
241- // const pattern = new MatcherPatternPathDynamic(
240+ it ( 'catch all route' , ( ) => {
241+ const pattern = new MatcherPatternPathDynamic (
242+ / ^ \/ ( .* ) $ / ,
243+ { pathMatch : [ ] } ,
244+ [ 0 ] ,
245+ null
246+ )
247+
248+ expect ( pattern . match ( '/ok' ) ) . toEqual ( { pathMatch : 'ok' } )
249+ expect ( pattern . match ( '/ok/ok/ok' ) ) . toEqual ( { pathMatch : 'ok/ok/ok' } )
250+ expect ( pattern . match ( '/' ) ) . toEqual ( { pathMatch : '' } )
242251 } )
243252
244253 it ( 'splat params with prefix' , ( ) => {
@@ -347,12 +356,13 @@ describe('MatcherPatternPathDynamic', () => {
347356 expect ( pattern . build ( { teamId : '123' } ) ) . toBe ( '/teams/123/' )
348357 } )
349358
350- it . todo ( 'can have a trailing slash after a static segment' , ( ) => {
351- const pattern = new MatcherPatternPathDynamic ( / ^ \/ t e a m s \/ b \/ $ / i, { } , [
352- 'teams' ,
353- 'b' ,
354- [ '/' ] ,
355- ] )
359+ it ( 'can have a trailing slash after a static segment' , ( ) => {
360+ const pattern = new MatcherPatternPathDynamic (
361+ / ^ \/ t e a m s \/ b \/ $ / i,
362+ { } ,
363+ [ 'teams' , 'b' ] ,
364+ true
365+ )
356366
357367 expect ( pattern . match ( '/teams/b/' ) ) . toEqual ( { } )
358368 expect ( ( ) => pattern . match ( '/teams/b' ) ) . toThrow ( )
You can’t perform that action at this time.
0 commit comments