refactor handler out
This commit is contained in:
21
src/cmd/server/handler/handler_test.go
Normal file
21
src/cmd/server/handler/handler_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package handler_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"show-rss/src/cmd/server/handler"
|
||||
"show-rss/src/db"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHandler(t *testing.T) {
|
||||
h := handler.New(db.Test(t, context.Background()))
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
r := httptest.NewRequest(http.MethodGet, "/not-found", nil)
|
||||
h.ServeHTTP(w, r)
|
||||
if w.Code != http.StatusNotFound {
|
||||
t.Errorf("%+v", w)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user