package views import ( "net/http/httptest" "strings" "testing" "hearthforge/internal/config" g "maragu.dev/gomponents" ) func TestLayoutAnonymous(t *testing.T) { cfg := &config.Config{OwnerDisplayName: "Admin"} rec := httptest.NewRecorder() Render(rec, 200, Layout(Page{Title: "Sign in", Cfg: cfg}, g.Text("body"))) body := rec.Body.String() for _, want := range []string{ "", "Sign in — Hearthforge", `Sign in`, } { if !strings.Contains(body, want) { t.Errorf("rendered page misses %q", want) } } if ct := rec.Header().Get("Content-Type"); ct != "text/html; charset=utf-8" { t.Errorf("content type = %q", ct) } }