@@ -47,8 +47,7 @@ describe("HistoryApiFallback", function() {
4747 server = helper . start ( config2 , {
4848 contentBase : path . join ( __dirname , "fixtures/historyapifallback-2-config" ) ,
4949 historyApiFallback : {
50- index : "/bar.html" ,
51- disableDotRule : true
50+ index : "/bar.html"
5251 }
5352 } , done ) ;
5453 req = request ( server . app ) ;
@@ -72,4 +71,43 @@ describe("HistoryApiFallback", function() {
7271 . expect ( 200 , / O t h e r f i l e / , done ) ;
7372 } ) ;
7473 } ) ;
74+
75+ describe ( "as object with contentBase and rewrites" , function ( ) {
76+ before ( function ( done ) {
77+ server = helper . start ( config2 , {
78+ contentBase : path . join ( __dirname , "fixtures/historyapifallback-2-config" ) ,
79+ historyApiFallback : {
80+ rewrites : [
81+ {
82+ from : / o t h e r / ,
83+ to : "/other.html"
84+ } ,
85+ {
86+ from : / .* / ,
87+ to : "/bar.html"
88+ }
89+ ]
90+ }
91+ } , done ) ;
92+ req = request ( server . app ) ;
93+ } ) ;
94+
95+ it ( "historyApiFallback respect rewrites for index" , function ( done ) {
96+ req . get ( "/" )
97+ . accept ( "html" )
98+ . expect ( 200 , / F o o b a r / , done ) ;
99+ } ) ;
100+
101+ it ( "historyApiFallback respect rewrites and shows index for unknown urls" , function ( done ) {
102+ req . get ( "/acme" )
103+ . accept ( "html" )
104+ . expect ( 200 , / F o o b a r / , done ) ;
105+ } ) ;
106+
107+ it ( "historyApiFallback respect any other specified rewrites" , function ( done ) {
108+ req . get ( "/other" )
109+ . accept ( "html" )
110+ . expect ( 200 , / O t h e r f i l e / , done ) ;
111+ } ) ;
112+ } ) ;
75113} ) ;
0 commit comments