@@ -86,11 +86,12 @@ func TestErisedHeadersRoute(t *testing.T) {
8686 })
8787}
8888
89- func TestErisedLandingRouteNoWait (t * testing.T ) {
89+ func TestErisedLandingRoute (t * testing.T ) {
9090 zerolog .SetGlobalLevel (zerolog .Disabled )
9191 g := goblin .Goblin (t )
9292 RegisterFailHandler (func (m string , _ ... int ) { g .Fail (m ) })
93- svr := server {}
93+ path := "."
94+ svr := server {pth : & path }
9495
9596 g .Describe ("Test /" , func () {
9697 g .It ("Should return StatusOK" , func () {
@@ -183,6 +184,20 @@ func TestErisedLandingRouteNoWait(t *testing.T) {
183184 Ω (res .Header ().Get ("X-Headers-Two" )).Should (Equal ("I'm header two" ))
184185 })
185186
187+ g .It ("Should return serverRoutes_test.json file content in body" , func () {
188+ exp := `{"Name":"serverRoutes_test"}`
189+ res := httptest .NewRecorder ()
190+ req := httptest .NewRequest (http .MethodGet , "http://localhost:8080/" , nil )
191+ req .Header .Set ("X-Erised-Content-Type" , "json" )
192+ req .Header .Set ("X-Erised-Response-File" , "serverRoutes_test.json" )
193+ svr .handleLanding ().ServeHTTP (res , req )
194+
195+ Ω (res ).Should (HaveHTTPStatus (http .StatusOK ))
196+ Ω (res .Header ().Get ("Content-Type" )).Should (Equal ("application/json" ))
197+ Ω (res .Header ().Get ("Content-Encoding" )).Should (Equal ("identity" ))
198+ Ω (res .Body .String ()).Should (Equal (exp ))
199+ })
200+
186201 g .It ("Should not fail" , func () {
187202 exp := `{"hello":"world"}`
188203 res := httptest .NewRecorder ()
@@ -201,21 +216,6 @@ func TestErisedLandingRouteNoWait(t *testing.T) {
201216 Ω (res .Header ().Get ("hello" )).Should (Equal ("world" ))
202217 Ω (res .Body .String ()).Should (Equal (exp ))
203218 })
204- })
205- }
206-
207- func TestErisedLandingRouteWait (t * testing.T ) {
208- zerolog .SetGlobalLevel (zerolog .Disabled )
209- g := goblin .Goblin (t )
210- RegisterFailHandler (func (m string , _ ... int ) { g .Fail (m ) })
211- svr := server {}
212-
213- g .Describe ("Test /" , func () {
214-
215- res := httptest .NewRecorder ()
216- req := httptest .NewRequest (http .MethodGet , "http://localhost:8080/" , nil )
217- req .Header .Set ("X-Erised-Response-Delay" , "2000" )
218- svr .handleLanding ().ServeHTTP (res , req )
219219
220220 g .It ("Should wait about 2000ms (±10ms)" , func () {
221221 res := httptest .NewRecorder ()
0 commit comments