refactor handler out

This commit is contained in:
Bel LaPointe
2025-04-28 21:39:09 -06:00
parent efb75f74cb
commit a59857b549
6 changed files with 120 additions and 103 deletions

View 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)
}
}