This commit is contained in:
2018-03-21 20:22:57 +01:00
parent 71d6f8c45a
commit 663d93c188
8 changed files with 126 additions and 223 deletions

View File

@ -9,17 +9,22 @@ import (
"github.com/aerogo/aero"
)
func TestRoutes(t *testing.T) {
// TestRouteStatusCodes tests the status code of every route registered in routeTests.
func TestRouteStatusCodes(t *testing.T) {
app := configure(aero.New())
// Iterate through every route
for _, examples := range routeTests {
// Iterate through every example specified for that route
for _, example := range examples {
// Create a new HTTP request
request, err := http.NewRequest("GET", example, nil)
if err != nil {
t.Fatal(err)
}
// Record the response without actually starting the server
responseRecorder := httptest.NewRecorder()
app.Handler().ServeHTTP(responseRecorder, request)