@@ -47,8 +47,7 @@ describe("HistoryApiFallback", function() {
47
47
server = helper . start ( config2 , {
48
48
contentBase : path . join ( __dirname , "fixtures/historyapifallback-2-config" ) ,
49
49
historyApiFallback : {
50
- index : "/bar.html" ,
51
- disableDotRule : true
50
+ index : "/bar.html"
52
51
}
53
52
} , done ) ;
54
53
req = request ( server . app ) ;
@@ -72,4 +71,43 @@ describe("HistoryApiFallback", function() {
72
71
. expect ( 200 , / O t h e r f i l e / , done ) ;
73
72
} ) ;
74
73
} ) ;
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
+ } ) ;
75
113
} ) ;
0 commit comments