generated from mathias/template-go-web
feat: Phase A — serve static CAD Atlas viz + self-contained context
Wire the reel-style CAD workflow atlas (signal→pod) as the served page via go:embed. Fill PROJECT.md/README with the 9-stage workflow, three governance gates (Ed25519 admission / dispatch-allow / var-go Oath), phase map A→C, dogfooding model, brain deep-links and external references. Fixes two template-go-web latent bugs surfaced by dogfooding: - templ version skew: go.mod pinned v0.2.778 vs templ@latest generator - .gitignore pattern *.templ.go did not match generated *_templ.go Verified: go build · vet · golangci-lint (0 issues) · go test green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRootServesAtlas(t *testing.T) {
|
||||
srv := httptest.NewServer(NewHandler())
|
||||
defer srv.Close()
|
||||
|
||||
resp, err := http.Get(srv.URL + "/")
|
||||
if err != nil {
|
||||
t.Fatalf("GET /: %v", err)
|
||||
}
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
t.Fatalf("GET / status = %d, want 200", resp.StatusCode)
|
||||
}
|
||||
buf := make([]byte, 4096)
|
||||
n, _ := resp.Body.Read(buf)
|
||||
if !strings.Contains(string(buf[:n]), "CAD") {
|
||||
t.Fatalf("GET / body missing atlas marker %q", "CAD")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnknownPath404(t *testing.T) {
|
||||
srv := httptest.NewServer(NewHandler())
|
||||
defer srv.Close()
|
||||
|
||||
resp, err := http.Get(srv.URL + "/nope")
|
||||
if err != nil {
|
||||
t.Fatalf("GET /nope: %v", err)
|
||||
}
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
if resp.StatusCode != http.StatusNotFound {
|
||||
t.Fatalf("GET /nope status = %d, want 404", resp.StatusCode)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user