File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,29 @@ describe('Path parser', () => {
147
147
] )
148
148
} )
149
149
150
+ it ( 'param custom re followed by param without regex' , ( ) => {
151
+ expect ( tokenizePath ( '/:one(\\d+)/:two' ) ) . toEqual ( [
152
+ [
153
+ {
154
+ type : TokenType . Param ,
155
+ value : 'one' ,
156
+ regexp : '\\d+' ,
157
+ repeatable : false ,
158
+ optional : false ,
159
+ } ,
160
+ ] ,
161
+ [
162
+ {
163
+ type : TokenType . Param ,
164
+ value : 'two' ,
165
+ regexp : '' ,
166
+ repeatable : false ,
167
+ optional : false ,
168
+ } ,
169
+ ] ,
170
+ ] )
171
+ } )
172
+
150
173
it ( 'param custom re?' , ( ) => {
151
174
expect ( tokenizePath ( '/:id(\\d+)?' ) ) . toEqual ( [
152
175
[
Original file line number Diff line number Diff line change @@ -147,7 +147,6 @@ export function tokenizePath(path: string): Array<Token[]> {
147
147
case TokenizerState . Param :
148
148
if ( char === '(' ) {
149
149
state = TokenizerState . ParamRegExp
150
- customRe = ''
151
150
} else if ( VALID_PARAM_RE . test ( char ) ) {
152
151
addCharToBuffer ( )
153
152
} else {
@@ -180,6 +179,7 @@ export function tokenizePath(path: string): Array<Token[]> {
180
179
state = TokenizerState . Static
181
180
// go back one character if we were not modifying
182
181
if ( char !== '*' && char !== '?' && char !== '+' ) i --
182
+ customRe = ''
183
183
break
184
184
185
185
default :
You can’t perform that action at this time.
0 commit comments