Files
artex/server/webui_stub_localized_test.go
T
dela 97668dab7e
ci / go (push) Waiting to run
ci / go-db (agent) (push) Waiting to run
ci / go-db (config) (push) Waiting to run
ci / go-db (db) (push) Waiting to run
ci / go-db (evidence) (push) Waiting to run
ci / go-db (llmrec) (push) Waiting to run
ci / go-db (server) (push) Waiting to run
detections / detections (push) Waiting to run
docs / links (push) Waiting to run
web / web (push) Waiting to run
Localize user-facing UI, agent output, and backend messages to Simplified Chinese
2026-10-09 14:08:31 +08:00

34 lines
1.1 KiB
Go

//go:build !embedui
package server
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
)
// TestWebUIStubErrorLocalized guards the no-embed stub's HTTP response: a request
// served by the default (!embedui) build must get a Korean 404 body, not the old
// Chinese one. This is the last user-facing HTTP error response in server/ that the
// earlier `writeErr(`-only sweeps missed (it uses http.Error, not writeErr). If an
// upstream re-sync reintroduces the Chinese literal, this test fails.
func TestWebUIStubErrorLocalized(t *testing.T) {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/", nil)
(&Server{}).webuiHandler().ServeHTTP(rec, req)
if rec.Code != http.StatusNotFound {
t.Fatalf("상태 코드가 404 가 아닙니다: %d", rec.Code)
}
body := strings.TrimSpace(rec.Body.String())
assertChineseError(t, "webui.stub", body)
// 명령 참조는 원문 그대로 보존되어야 한다(번역 대상 아님).
for _, want := range []string{"next dev", "-tags embedui"} {
if !strings.Contains(body, want) {
t.Fatalf("명령 참조 %q 가 응답에 없습니다: %q", want, body)
}
}
}