Repository navigation
Expand file tree
/
Copy pathai-hud-i18n.test.ts
More file actions
58 lines (54 loc) · 1.83 KB
/
Copy pathai-hud-i18n.test.ts
File metadata and controls
58 lines (54 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { describe, expect, it } from "vitest";
import {
AI_HUD_ACTIVITY_TRANSLATIONS,
AI_HUD_TRANSLATIONS,
aiHudStatusLabel,
localizeAiTranscriptLines,
translateAiHud,
} from "./ai-hud-i18n";
import { SUPPORTED_LOCALES } from "./i18n/locale-registry";
import { createAiHudSnapshot } from "./ai-hud-state";
describe("Ask AI HUD translations", () => {
it("provides a complete non-empty dictionary for every supported locale", () => {
expect(Object.keys(AI_HUD_TRANSLATIONS).sort()).toEqual(
[...SUPPORTED_LOCALES].sort(),
);
for (const locale of SUPPORTED_LOCALES) {
expect(Object.values(AI_HUD_TRANSLATIONS[locale]).every(
(value) => value.trim().length > 0,
)).toBe(true);
expect(Object.values(AI_HUD_ACTIVITY_TRANSLATIONS[locale]).every(
(value) => value.trim().length > 0,
)).toBe(true);
}
});
it("localizes phases and transcript roles without changing conversation text", () => {
expect(translateAiHud("ko", "listening")).toBe("듣는 중…");
expect(localizeAiTranscriptLines([
"YOU // 안녕하세요",
" 이어지는 말",
"AI // 반갑습니다",
],
"ko",
)).toEqual([
"사용자 // 안녕하세요",
" 이어지는 말",
"AI // 반갑습니다",
]);
});
it("prioritizes safe tool status over delayed and normal phases", () => {
const base = {
...createAiHudSnapshot(true),
phase: "displaying" as const,
};
expect(aiHudStatusLabel({
...base,
activeTool: { id: "search-1", kind: "web-search" },
}, "ko")).toBe("웹 검색 중…");
expect(aiHudStatusLabel({
...base,
activeTool: { id: "mcp-1", kind: "mcp", displayName: "Docs" },
}, "en")).toBe("USING MCP // Docs");
expect(aiHudStatusLabel(base, "en")).toBe("DISPLAYING RESPONSE…");
});
});