feat: initialize license platform implementation
Add the Go Gin backend skeleton, Vue frontend shell, health check, CI workflow, implementation docs, and static review demo.\n\nCo-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
28
backend/internal/httpapi/router_test.go
Normal file
28
backend/internal/httpapi/router_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLiveness(t *testing.T) {
|
||||
w := httptest.NewRecorder()
|
||||
NewRouter().ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/api/v1/health/live", nil))
|
||||
if w.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want 200", w.Code)
|
||||
}
|
||||
var body struct{ Status string `json:"status"` }
|
||||
if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil || body.Status != "ok" {
|
||||
t.Fatalf("body = %q, err = %v", w.Body.String(), err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnknownRoute(t *testing.T) {
|
||||
w := httptest.NewRecorder()
|
||||
NewRouter().ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/api/v1/licenses", nil))
|
||||
if w.Code != http.StatusNotFound {
|
||||
t.Fatalf("status = %d, want 404", w.Code)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user