package webui
import (
"io/fs"
"net/http"
"net/http/httptest"
"strings"
"testing"
"testing/fstest"
"github.com/nextlevelbuilder/goclaw/internal/config"
)
func TestHandlerInjectsBrandingMetadataIntoIndex(t *testing.T) {
fsys := fstest.MapFS{
"index.html": &fstest.MapFile{Data: []byte(`
GoClaw`)},
}
cfg := config.Default()
cfg.Branding = config.BrandingConfig{
AppName: "Acme Agents",
MetaTitle: "Acme Agents Console",
MetaDescription: "Private agent dashboard",
MetaKeywords: "agents, automation",
LogoURL: "/branding-assets/logo.png",
FaviconURL: "/branding-assets/favicon.ico",
AppleTouchIconURL: "/branding-assets/apple.png",
OGTitle: "Acme Social Title",
OGDescription: "Acme social description",
OGImageURL: "/branding-assets/og.webp",
ThemeColor: "#123456",
}
h := NewHandlerForFS(fsys, cfg)
rec := httptest.NewRecorder()
h.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/settings", nil))
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want 200", rec.Code)
}
body := rec.Body.String()
for _, want := range []string{
`Acme Agents Console`,
`