From 02e60b8db5a3930fa9a36667ba7dd31350f5e1d2 Mon Sep 17 00:00:00 2001 From: Rogee Date: Mon, 24 Aug 2026 10:26:45 +0800 Subject: [PATCH] test(HH-589): cover favicon static route (#150) Co-authored-by: Rogee --- backend/internal/router/router_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/internal/router/router_test.go b/backend/internal/router/router_test.go index 139b30a9..515d74ee 100644 --- a/backend/internal/router/router_test.go +++ b/backend/internal/router/router_test.go @@ -1081,6 +1081,10 @@ func TestDashboardIndexServesChatwootShell(t *testing.T) { if err := os.WriteFile(filepath.Join(dist, "assets", "app.js"), []byte(`document.documentElement.dataset.runtimeHost = window.__GOCHAT_CONFIG__?.hostURL || "missing";`), 0o644); err != nil { t.Fatal(err) } + favicon := []byte("gochat favicon") + if err := os.WriteFile(filepath.Join(dist, "favicon.ico"), favicon, 0o644); err != nil { + t.Fatal(err) + } t.Setenv("GOCHAT_FRONTEND_DIST", dist) t.Setenv("INSTALLATION_NAME", "GoChat Test") t.Setenv("FRONTEND_URL", "https://app.example.test/") @@ -1146,6 +1150,10 @@ func TestDashboardIndexServesChatwootShell(t *testing.T) { if asset.Code != http.StatusOK || asset.Body.String() != "body{}" { t.Fatalf("expected built asset, got %d %q", asset.Code, asset.Body.String()) } + faviconResponse := performGet(engine, "/favicon.ico") + if faviconResponse.Code != http.StatusOK || faviconResponse.Body.String() != string(favicon) { + t.Fatalf("expected built favicon, got %d %q", faviconResponse.Code, faviconResponse.Body.String()) + } } func TestDashboardIndexRejectsJSONLikeChatwoot(t *testing.T) {