test(HH-589): cover favicon static route (#150)

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-24 10:26:45 +08:00
committed by GitHub
co-authored by rogee
parent b981cc6811
commit 02e60b8db5
+8
View File
@@ -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) {