@@ -327,48 +327,49 @@ describe('isLayerIgnored', () => {
327327
328328describe ( 'getActualMatchedRoute' , ( ) => {
329329 it ( 'handles empty layersStore' , ( ) => {
330- expect ( getActualMatchedRoute ( { } as unknown as ExpressRequest ) ) . toBe ( undefined ) ;
330+ const req = { } as unknown as ExpressRequest ;
331+ expect ( getActualMatchedRoute ( req , getConstructedRoute ( req ) ) ) . toBe ( undefined ) ;
331332 } ) ;
332333
333334 it ( 'handles case when all stored layers are /' , ( ) => {
334335 const req = { originalUrl : '/' } as unknown as ExpressRequest ;
335336 storeLayer ( req , '/' ) ;
336- expect ( getActualMatchedRoute ( req ) ) . toBe ( '/' ) ;
337+ expect ( getActualMatchedRoute ( req , getConstructedRoute ( req ) ) ) . toBe ( '/' ) ;
337338 req . originalUrl = '/other-thing' ;
338- expect ( getActualMatchedRoute ( req ) ) . toBe ( undefined ) ;
339+ expect ( getActualMatchedRoute ( req , getConstructedRoute ( req ) ) ) . toBe ( undefined ) ;
339340 } ) ;
340341
341342 it ( 'returns constructed route if *' , ( ) => {
342343 const req = { originalUrl : '/xyz' } as unknown as ExpressRequest ;
343344 storeLayer ( req , '*' ) ;
344- expect ( getActualMatchedRoute ( req ) ) . toBe ( '*' ) ;
345+ expect ( getActualMatchedRoute ( req , getConstructedRoute ( req ) ) ) . toBe ( '*' ) ;
345346 } ) ;
346347
347348 it ( 'returns constructed route when it looks regexp-ish' , ( ) => {
348349 const req = { originalUrl : '/xyz' } as unknown as ExpressRequest ;
349350 storeLayer ( req , '/\\,[*]/' ) ;
350- expect ( getActualMatchedRoute ( req ) ) . toBe ( '/\\,[*]/' ) ;
351+ expect ( getActualMatchedRoute ( req , getConstructedRoute ( req ) ) ) . toBe ( '/\\,[*]/' ) ;
351352 } ) ;
352353
353354 it ( 'ensures constructed route starts with /' , ( ) => {
354355 const req = { originalUrl : '/a/b' } as unknown as ExpressRequest ;
355356 storeLayer ( req , 'a' ) ;
356357 storeLayer ( req , '/b' ) ;
357- expect ( getActualMatchedRoute ( req ) ) . toBe ( '/a/b' ) ;
358+ expect ( getActualMatchedRoute ( req , getConstructedRoute ( req ) ) ) . toBe ( '/a/b' ) ;
358359 } ) ;
359360
360361 it ( 'allows routes that contain *' , ( ) => {
361362 const req = { originalUrl : '/a/b' } as unknown as ExpressRequest ;
362363 storeLayer ( req , 'a' ) ;
363364 storeLayer ( req , '/:boo' ) ;
364- expect ( getActualMatchedRoute ( req ) ) . toBe ( '/a/:boo' ) ;
365+ expect ( getActualMatchedRoute ( req , getConstructedRoute ( req ) ) ) . toBe ( '/a/:boo' ) ;
365366 } ) ;
366367
367368 it ( 'returns undefined if invalid' , ( ) => {
368369 const req = { originalUrl : '/a/b' } as unknown as ExpressRequest ;
369370 storeLayer ( req , '/a' ) ;
370371 storeLayer ( req , '/c' ) ;
371- expect ( getActualMatchedRoute ( req ) ) . toBe ( undefined ) ;
372+ expect ( getActualMatchedRoute ( req , getConstructedRoute ( req ) ) ) . toBe ( undefined ) ;
372373 } ) ;
373374} ) ;
374375
0 commit comments