返回 DeepSeek-Reasonix
topicbar-controls.test.ts
根目录 / desktop / frontend / src / __tests__ / topicbar-controls.test.ts
1 // Run: tsx src/__tests__/topicbar-controls.test.ts
2
3 import { strict as assert } from "node:assert";
4 import { readFileSync } from "node:fs";
5 import { dirname, resolve } from "node:path";
6 import { fileURLToPath } from "node:url";
7
8 const testDir = dirname(fileURLToPath(import.meta.url));
9 const appSource = readFileSync(resolve(testDir, "../AppRuntime.tsx"), "utf8");
10 const dockToggleSource = readFileSync(resolve(testDir, "../app-shell/DockToggleButton.tsx"), "utf8");
11 const sessionActionsSource = readFileSync(resolve(testDir, "../components/TopicbarSessionActions.tsx"), "utf8");
12
13 assert.doesNotMatch(appSource, /t\("shortcuts\.cheatsheetTitle"\)|t\("topicBar\.command"\)/);
14
15 const taskSummaryControlIndex = sessionActionsSource.indexOf('t("summary.session")');
16 const workspaceToggleIndex = dockToggleSource.indexOf('<Tooltip label={renderable ? t("rightDock.collapse") : t("rightDock.expand")}>');
17 assert.ok(taskSummaryControlIndex >= 0, "topic bar renders the localized Session summary control");
18 assert.ok(workspaceToggleIndex >= 0, "topic bar keeps the right-edge workspace toggle");
19 // Remote/local surface policy is exercised by conversation-projection.test.ts
20 // against the production projection and mounted WorkspaceDockRegion.
21 assert.ok(!sessionActionsSource.includes('aria-label="Session summary"'), "Session summary does not use a hard-coded English label");
22
23 process.stdout.write("topicbar static presentation contracts passed\n");
24
24 lines TYPESCRIPT