Skip to content

Commit 308bc2c

Browse files
committed
Initial tests added
1 parent af440e5 commit 308bc2c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

handlers_test.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ import (
44
"net/http"
55
"net/http/httptest"
66
"testing"
7+
8+
"github.com/gorilla/mux"
79
)
810

911
func TestFrontPage(t *testing.T) {
10-
//req, _ := http.NewRequest("GET", "", nil)
1112
w := httptest.NewRecorder()
13+
r := mux.NewRouter()
14+
15+
req, _ := http.NewRequest("GET", "/", nil)
16+
r.HandleFunc("/", frontPageHandler).Methods("GET")
17+
r.ServeHTTP(w, req)
18+
1219
if w.Code != http.StatusOK {
13-
t.Errorf("Home page didn't return %v", http.StatusOK)
20+
t.Errorf("Frontpage return code %v instead %v", w.Code, http.StatusOK)
1421
}
1522
}

0 commit comments

Comments
 (0)