@@ -7,23 +7,23 @@ function doExec(path, route, opts) {
7
7
describe ( 'match' , ( ) => {
8
8
it ( 'Base route' , ( ) => {
9
9
const accurateResult = doExec ( '/' , '/' ) ;
10
- expect ( accurateResult ) . toEqual ( { path : '/' , params : { } } ) ;
10
+ expect ( accurateResult ) . toEqual ( { path : '/' , params : { } , query : { } } ) ;
11
11
12
12
const inaccurateResult = doExec ( '/user/1' , '/' ) ;
13
13
expect ( inaccurateResult ) . toEqual ( undefined ) ;
14
14
} ) ;
15
15
16
16
it ( 'Param route' , ( ) => {
17
17
const accurateResult = doExec ( '/user/2' , '/user/:id' ) ;
18
- expect ( accurateResult ) . toEqual ( { path : '/' , params : { id : '2' } } ) ;
18
+ expect ( accurateResult ) . toEqual ( { path : '/' , params : { id : '2' } , query : { } } ) ;
19
19
20
20
const inaccurateResult = doExec ( '/' , '/user/:id' ) ;
21
21
expect ( inaccurateResult ) . toEqual ( undefined ) ;
22
22
} ) ;
23
23
24
24
it ( 'Optional param route' , ( ) => {
25
25
const accurateResult = doExec ( '/user' , '/user/:id?' ) ;
26
- expect ( accurateResult ) . toEqual ( { path : '/' , params : { id : undefined } } ) ;
26
+ expect ( accurateResult ) . toEqual ( { path : '/' , params : { id : undefined } , query : { } } ) ;
27
27
28
28
const inaccurateResult = doExec ( '/' , '/user/:id?' ) ;
29
29
expect ( inaccurateResult ) . toEqual ( undefined ) ;
@@ -35,15 +35,18 @@ describe('match', () => {
35
35
params : {
36
36
seg1 : '_SEGMENT1_' ,
37
37
seg2 : '_SEGMENT2_'
38
- }
38
+ } ,
39
+ path : '/about-late/_SEGMENT1_/_SEGMENT2_/' ,
40
+ query : { }
39
41
} ) ;
40
42
} ) ;
41
43
42
44
it ( 'should not overwrite existing properties' , ( ) => {
43
45
const result = doExec ( '/foo/bar' , '/:path/:query' ) ;
44
46
expect ( result ) . toEqual ( {
45
47
params : { path : 'foo' , query : 'bar' } ,
46
- path : '/'
48
+ path : '/foo/bar' ,
49
+ query : { }
47
50
} ) ;
48
51
} ) ;
49
52
} ) ;
0 commit comments