@@ -81,12 +81,22 @@ const COMPILE_TESTS: CompileTestSet[] = [
81
81
{ input : undefined , expected : null } ,
82
82
{ input : { } , expected : null } ,
83
83
{ input : { test : "123" } , expected : "/123" } ,
84
- { input : { test : "123/xyz" } , expected : null } , // Requires encoding.
84
+ { input : { test : "123/xyz" } , expected : "/123%2Fxyz" } ,
85
85
] ,
86
86
} ,
87
87
{
88
88
path : "/:test" ,
89
89
options : { validate : false } ,
90
+ tests : [
91
+ { input : undefined , expected : null } ,
92
+ { input : { } , expected : null } ,
93
+ { input : { test : "123" } , expected : "/123" } ,
94
+ { input : { test : "123/xyz" } , expected : "/123%2Fxyz" } ,
95
+ ] ,
96
+ } ,
97
+ {
98
+ path : "/:test" ,
99
+ options : { validate : false , encode : false } ,
90
100
tests : [
91
101
{ input : undefined , expected : null } ,
92
102
{ input : { } , expected : null } ,
@@ -116,16 +126,18 @@ const COMPILE_TESTS: CompileTestSet[] = [
116
126
} ,
117
127
{
118
128
path : "/:test?" ,
129
+ options : { encode : false } ,
119
130
tests : [
120
131
{ input : undefined , expected : "" } ,
121
132
{ input : { } , expected : "" } ,
122
133
{ input : { test : undefined } , expected : "" } ,
123
134
{ input : { test : "123" } , expected : "/123" } ,
124
- { input : { test : "123/xyz" } , expected : null } , // Requires encoding.
135
+ { input : { test : "123/xyz" } , expected : null } ,
125
136
] ,
126
137
} ,
127
138
{
128
139
path : "/:test(.*)" ,
140
+ options : { encode : false } ,
129
141
tests : [
130
142
{ input : undefined , expected : null } ,
131
143
{ input : { } , expected : null } ,
@@ -134,6 +146,30 @@ const COMPILE_TESTS: CompileTestSet[] = [
134
146
{ input : { test : "123/xyz" } , expected : "/123/xyz" } ,
135
147
] ,
136
148
} ,
149
+ {
150
+ path : "/:test*" ,
151
+ tests : [
152
+ { input : undefined , expected : "" } ,
153
+ { input : { } , expected : "" } ,
154
+ { input : { test : [ ] } , expected : "" } ,
155
+ { input : { test : [ "" ] } , expected : null } ,
156
+ { input : { test : [ "123" ] } , expected : "/123" } ,
157
+ { input : { test : "123/xyz" } , expected : null } ,
158
+ { input : { test : [ "123" , "xyz" ] } , expected : "/123/xyz" } ,
159
+ ] ,
160
+ } ,
161
+ {
162
+ path : "/:test*" ,
163
+ options : { encode : false } ,
164
+ tests : [
165
+ { input : undefined , expected : "" } ,
166
+ { input : { } , expected : "" } ,
167
+ { input : { test : "" } , expected : null } ,
168
+ { input : { test : "123" } , expected : "/123" } ,
169
+ { input : { test : "123/xyz" } , expected : "/123/xyz" } ,
170
+ { input : { test : [ "123" , "xyz" ] } , expected : null } ,
171
+ ] ,
172
+ } ,
137
173
] ;
138
174
139
175
/**
@@ -235,7 +271,7 @@ const MATCH_TESTS: MatchTestSet[] = [
235
271
expected : {
236
272
path : "/caf%C3%A9" ,
237
273
index : 0 ,
238
- params : { test : "caf%C3%A9 " } ,
274
+ params : { test : "café " } ,
239
275
} ,
240
276
} ,
241
277
{
@@ -531,7 +567,7 @@ const MATCH_TESTS: MatchTestSet[] = [
531
567
expected : {
532
568
path : "/caf%C3%A9" ,
533
569
index : 0 ,
534
- params : { test : "caf%C3%A9 " } ,
570
+ params : { test : "café " } ,
535
571
} ,
536
572
} ,
537
573
] ,
@@ -2257,13 +2293,17 @@ const MATCH_TESTS: MatchTestSet[] = [
2257
2293
{
2258
2294
path : "/:foo" ,
2259
2295
options : {
2260
- decode : encodeURIComponent ,
2296
+ decode : false ,
2261
2297
} ,
2262
2298
tests : [
2263
2299
{
2264
- input : "/café" ,
2265
- matches : [ "/café" , "café" ] ,
2266
- expected : { path : "/café" , index : 0 , params : { foo : "caf%C3%A9" } } ,
2300
+ input : "/caf%C3%A9" ,
2301
+ matches : [ "/caf%C3%A9" , "caf%C3%A9" ] ,
2302
+ expected : {
2303
+ path : "/caf%C3%A9" ,
2304
+ index : 0 ,
2305
+ params : { foo : "caf%C3%A9" } ,
2306
+ } ,
2267
2307
} ,
2268
2308
] ,
2269
2309
} ,
@@ -2771,6 +2811,22 @@ const MATCH_TESTS: MatchTestSet[] = [
2771
2811
} ,
2772
2812
] ,
2773
2813
} ,
2814
+ {
2815
+ path : "*" ,
2816
+ options : { decode : false } ,
2817
+ tests : [
2818
+ {
2819
+ input : "/" ,
2820
+ matches : [ "/" , "/" ] ,
2821
+ expected : { path : "/" , index : 0 , params : { "0" : "/" } } ,
2822
+ } ,
2823
+ {
2824
+ input : "/test" ,
2825
+ matches : [ "/test" , "/test" ] ,
2826
+ expected : { path : "/test" , index : 0 , params : { "0" : "/test" } } ,
2827
+ } ,
2828
+ ] ,
2829
+ } ,
2774
2830
2775
2831
/**
2776
2832
* No loose.
0 commit comments