@@ -21,6 +21,24 @@ var mockRouteHandler = new SyncRouteHandler(DummyClass);
2121
2222export function main ( ) {
2323 describe ( 'PathRecognizer' , ( ) => {
24+
25+ it ( 'should throw when given an invalid path' , ( ) => {
26+ expect ( ( ) => new PathRecognizer ( '/hi#' , mockRouteHandler ) )
27+ . toThrowError ( `Path "/hi#" should not include "#". Use "HashLocationStrategy" instead.` ) ;
28+ expect ( ( ) => new PathRecognizer ( 'hi?' , mockRouteHandler ) )
29+ . toThrowError ( `Path "hi?" contains "?" which is not allowed in a route config.` ) ;
30+ expect ( ( ) => new PathRecognizer ( 'hi;' , mockRouteHandler ) )
31+ . toThrowError ( `Path "hi;" contains ";" which is not allowed in a route config.` ) ;
32+ expect ( ( ) => new PathRecognizer ( 'hi=' , mockRouteHandler ) )
33+ . toThrowError ( `Path "hi=" contains "=" which is not allowed in a route config.` ) ;
34+ expect ( ( ) => new PathRecognizer ( 'hi(' , mockRouteHandler ) )
35+ . toThrowError ( `Path "hi(" contains "(" which is not allowed in a route config.` ) ;
36+ expect ( ( ) => new PathRecognizer ( 'hi)' , mockRouteHandler ) )
37+ . toThrowError ( `Path "hi)" contains ")" which is not allowed in a route config.` ) ;
38+ expect ( ( ) => new PathRecognizer ( 'hi//there' , mockRouteHandler ) )
39+ . toThrowError ( `Path "hi//there" contains "//" which is not allowed in a route config.` ) ;
40+ } ) ;
41+
2442 describe ( 'matrix params' , ( ) => {
2543 it ( 'should recognize a trailing matrix value on a path value and assign it to the params return value' ,
2644 ( ) => {
0 commit comments