@@ -25,14 +25,18 @@ describe("routeToRegExp", () => {
2525 match : [ [ "/path/value1/value2" , { param1 : "value1" , param2 : "value2" } ] ] ,
2626 } ,
2727 "/path/*/foo" : {
28- regex : / ^ \/ p a t h \/ [ ^ / ] * \/ f o o \/ ? $ / ,
29- match : [ [ "/path/anything/foo" ] , [ "/path//foo" ] , [ "/path//foo/" ] ] ,
28+ regex : / ^ \/ p a t h \/ (?< _0 > [ ^ / ] * ) \/ f o o \/ ? $ / ,
29+ match : [
30+ [ "/path/anything/foo" , { _0 : "anything" } ] ,
31+ [ "/path//foo" , { _0 : "" } ] ,
32+ [ "/path//foo/" , { _0 : "" } ] ,
33+ ] ,
3034 } ,
3135 "/path/**" : {
3236 regex : / ^ \/ p a t h \/ ? (?< _ > .* ) \/ ? $ / ,
3337 match : [
34- [ "/path/" ] ,
35- [ "/path" ] ,
38+ [ "/path/" , { _ : "" } ] ,
39+ [ "/path" , { _ : "" } ] ,
3640 [ "/path/anything/more" , { _ : "anything/more" } ] ,
3741 ] ,
3842 } ,
@@ -50,7 +54,14 @@ describe("routeToRegExp", () => {
5054 const regex = routeToRegExp ( route ) ;
5155
5256 for ( const [ path , params ] of expected . match ) {
53- expect ( findRoute ( router , "" , path ) ) . toMatchObject ( { data : { route } } ) ;
57+ expect ( findRoute ( router , "" , path ) ) . toMatchObject (
58+ params
59+ ? {
60+ data : { route } ,
61+ params,
62+ }
63+ : { data : { route } } ,
64+ ) ;
5465
5566 const match = path . match ( regex ) ;
5667 expect ( match , path ) . not . toBeNull ( ) ;
0 commit comments