Minor changes
This commit is contained in:
parent
0e81dc4e92
commit
8f0cdd45e0
23
main_test.go
23
main_test.go
@ -9,19 +9,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestRoutes(t *testing.T) {
|
func TestRoutes(t *testing.T) {
|
||||||
expectedStatus := http.StatusOK
|
|
||||||
|
|
||||||
app := configure(aero.New())
|
app := configure(aero.New())
|
||||||
request, err := http.NewRequest("GET", "/", nil)
|
|
||||||
|
|
||||||
if err != nil {
|
for _, examples := range tests {
|
||||||
t.Fatal(err)
|
for _, example := range examples {
|
||||||
}
|
request, err := http.NewRequest("GET", example, nil)
|
||||||
|
|
||||||
responseRecorder := httptest.NewRecorder()
|
if err != nil {
|
||||||
app.Handler().ServeHTTP(responseRecorder, request)
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
if status := responseRecorder.Code; status != expectedStatus {
|
responseRecorder := httptest.NewRecorder()
|
||||||
t.Errorf("Wrong status code: %v instead of %v", status, expectedStatus)
|
app.Handler().ServeHTTP(responseRecorder, request)
|
||||||
|
|
||||||
|
if status := responseRecorder.Code; status != http.StatusOK {
|
||||||
|
t.Errorf("%s | Wrong status code | %v instead of %v", example, status, http.StatusOK)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user