57dc91585d
Internal SmartGift build of a Claude Code monitoring dashboard. Lanes: a durable unit of parallel agent work, one per working directory, tracked across session restarts. Managed lanes are git worktrees the dashboard provisions and can reset or remove behind a three-check destroy guard and a counted preflight; adopted lanes are directories you already own and are never destroyable. Pipelines: a lane moves through pipeline stages. A stage the agent declares with evidence renders green; a stage inferred from the tool-event stream renders dashed amber and never counts as done. Detection is forward-only within a 30-minute window, and never writes the declared stage. Workspace: one page at /run with a lane grid, the selected lane's pipeline, and a full Claude console behind a disclosure.
53 lines
2.2 KiB
TypeScript
53 lines
2.2 KiB
TypeScript
/**
|
|
* @file i18n.test.ts
|
|
* @description Unit tests for i18n translation resources to ensure correct translations and locale handling in the agent dashboard application.
|
|
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
|
*/
|
|
|
|
import { describe, it, expect } from "vitest";
|
|
import i18n from "i18next";
|
|
|
|
describe("i18n resources", () => {
|
|
it("should provide Vietnamese translations for navigation keys", async () => {
|
|
await i18n.changeLanguage("vi");
|
|
|
|
expect(i18n.t("nav:dashboard")).toBe("Tổng quan");
|
|
expect(i18n.t("nav:agentBoard")).toBe("Bảng Kanban");
|
|
expect(i18n.t("nav:languageShort.vi")).toBe("VI");
|
|
});
|
|
|
|
it("should keep Agent terminology untranslated in the vi locale", async () => {
|
|
await i18n.changeLanguage("vi");
|
|
expect(i18n.t("common:agent")).toBe("Agent");
|
|
expect(i18n.t("common:subagent")).toBe("Subagent");
|
|
});
|
|
|
|
it("should support non-explicit Vietnamese locale tags", async () => {
|
|
await i18n.changeLanguage("vi-VN");
|
|
|
|
expect(i18n.resolvedLanguage?.startsWith("vi")).toBe(true);
|
|
expect(i18n.t("nav:dashboard")).toBe("Tổng quan");
|
|
});
|
|
|
|
it("falls back to English for a language the dashboard no longer ships", async () => {
|
|
await i18n.changeLanguage("ko");
|
|
|
|
// Korean and Chinese were removed; an unsupported tag must degrade to
|
|
// English rather than render raw keys.
|
|
expect(i18n.t("nav:dashboard")).toBe("Dashboard");
|
|
});
|
|
|
|
it("pluralizes the subagent count labels in English", async () => {
|
|
await i18n.changeLanguage("en");
|
|
// The collapsed agent-tree badge (Dashboard) and SessionDetail both render
|
|
// this key with a count. It MUST use i18next plural forms (_one/_other) so
|
|
// "2 subagent" never shows — the flat common:subagent word is not a plural
|
|
// key and rendering it with a count is the bug this guards against.
|
|
expect(i18n.t("common:subagent_label", { count: 1 })).toBe("1 subagent");
|
|
expect(i18n.t("common:subagent_label", { count: 2 })).toBe("2 subagents");
|
|
// The main-agent card subtitle carries its own kanban plural key.
|
|
expect(i18n.t("kanban:session.subagentSummary", { count: 1 })).toBe("1 subagent");
|
|
expect(i18n.t("kanban:session.subagentSummary", { count: 3 })).toBe("3 subagents");
|
|
});
|
|
});
|