@@ -76,6 +76,32 @@ export function main() {
7676 expect ( solution . matchedUrl ) . toEqual ( '/b' ) ; 
7777 } ) ; 
7878
79+  it ( 'should not perform root URL redirect on a non-root route' ,  ( )  =>  { 
80+  recognizer . addRedirect ( '/' ,  '/foo' ) ; 
81+  recognizer . addConfig ( '/bar' ,  handler ) ; 
82+  var  solutions  =  recognizer . recognize ( '/bar' ) ; 
83+  expect ( solutions . length ) . toBe ( 1 ) ; 
84+ 
85+  var  solution  =  solutions [ 0 ] ; 
86+  expect ( solution . handler ) . toEqual ( handler ) ; 
87+  expect ( solution . matchedUrl ) . toEqual ( '/bar' ) ; 
88+  } ) ; 
89+ 
90+  it ( 'should perform a valid redirect when a slash or an empty string is being processed' ,  ( )  =>  { 
91+  recognizer . addRedirect ( '/' ,  '/matias' ) ; 
92+  recognizer . addRedirect ( '' ,  '/fatias' ) ; 
93+ 
94+  recognizer . addConfig ( '/matias' ,  handler ) ; 
95+  recognizer . addConfig ( '/fatias' ,  handler ) ; 
96+ 
97+  var  solutions ; 
98+ 
99+  solutions  =  recognizer . recognize ( '/' ) ; 
100+  expect ( solutions [ 0 ] . matchedUrl ) . toBe ( '/matias' ) ; 
101+ 
102+  solutions  =  recognizer . recognize ( '' ) ; 
103+  expect ( solutions [ 0 ] . matchedUrl ) . toBe ( '/fatias' ) ; 
104+  } ) ; 
79105
80106 it ( 'should generate URLs' ,  ( )  =>  { 
81107 recognizer . addConfig ( '/app/user/:name' ,  handler ,  'user' ) ; 
0 commit comments