@@ -482,7 +482,7 @@ describe('interpolatePath', () => {
482
482
} )
483
483
} )
484
484
485
- describe ( 'named params (prefix + suffix' , ( ) => {
485
+ describe ( 'named params (prefix + suffix) ' , ( ) => {
486
486
it . each ( [
487
487
{
488
488
name : 'regular' ,
@@ -523,6 +523,48 @@ describe('interpolatePath', () => {
523
523
) . toBe ( result )
524
524
} )
525
525
} )
526
+
527
+ describe ( 'splat route missing parameter issue' , ( ) => {
528
+ it . each ( [
529
+ {
530
+ name : 'should handle missing _splat parameter for basic splat route' ,
531
+ path : '/hello/$' ,
532
+ params : { } ,
533
+ expectedResult : '/hello' ,
534
+ } ,
535
+ {
536
+ name : 'should handle missing _splat parameter for splat route with prefix' ,
537
+ path : '/hello/prefix{$}' ,
538
+ params : { } ,
539
+ expectedResult : '/hello/prefix' ,
540
+ } ,
541
+ {
542
+ name : 'should handle missing _splat parameter for splat route with suffix' ,
543
+ path : '/hello/{$}suffix' ,
544
+ params : { } ,
545
+ expectedResult : '/hello/suffix' ,
546
+ } ,
547
+ {
548
+ name : 'should handle missing _splat parameter for splat route with prefix and suffix' ,
549
+ path : '/hello/prefix{$}suffix' ,
550
+ params : { } ,
551
+ expectedResult : '/hello/prefixsuffix' ,
552
+ } ,
553
+ {
554
+ name : 'should handle missing _splat parameter for nested splat route' ,
555
+ path : '/users/$id/$' ,
556
+ params : { id : '123' } ,
557
+ expectedResult : '/users/123' ,
558
+ } ,
559
+ ] ) ( '$name' , ( { path, params, expectedResult } ) => {
560
+ const result = interpolatePath ( {
561
+ path,
562
+ params,
563
+ } )
564
+ expect ( result . interpolatedPath ) . toBe ( expectedResult )
565
+ expect ( result . isMissingParams ) . toBe ( true )
566
+ } )
567
+ } )
526
568
} )
527
569
528
570
describe ( 'matchPathname' , ( ) => {
0 commit comments