xworkmate-app/go_service/internal/handler/auth_handler_test.go
2026-04-08 16:35:25 +08:00

23 lines
447 B
Go

package handler
import (
"net/http"
"net/http/httptest"
"testing"
"xworkmate/go_service/internal/service"
)
func TestAuthHandlerServeHTTP(t *testing.T) {
h := NewAuthHandler(service.NewAuthService("secret"))
req := httptest.NewRequest(http.MethodGet, "/", nil)
req.Header.Set("Authorization", "secret")
rr := httptest.NewRecorder()
h.ServeHTTP(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("expected 200, got %d", rr.Code)
}
}