返回 DeepSeek-Reasonix
controller-notices-heads.test.ts
根目录 / desktop / frontend / src / __tests__ / controller-notices-heads.test.ts
1 // Run: tsx src/__tests__/controller-notices-heads.test.ts
2 //
3 // Head notices from the session log localize by their stable code so the
4 // backend text, which may carry a head id, never reaches the transcript.
5
6 import assert from "node:assert/strict";
7 import { localizedNoticeText, quietTranscriptNoticeKey } from "../lib/controllerNotices";
8
9 const cases: Array<[string, string, string]> = [
10 ["session_concurrent_writer", "another writer appended to this session log", "Another Reasonix window or process added to this conversation. Its content is kept as a separate version; use View versions to switch."],
11 ["session_head_switched", "opened head 01HEAD (newest activity)", "Opened the newest version of this conversation. Other saved versions are available in View versions."],
12 ["session_head_selected", "selected head 01HEAD", "This version is now the current version of the conversation."],
13 ];
14 for (const [code, raw, want] of cases) {
15 assert.equal(localizedNoticeText(raw, code), want, `${code} localizes by code`);
16 assert.equal(quietTranscriptNoticeKey(raw, code), "", `${code} is shown, not a quiet lifecycle notice`);
17 assert.ok(!localizedNoticeText(raw, code).includes("01HEAD"), `${code} must not leak head ids`);
18 }
19 console.log(" PASS session-log head notices localize by code and stay visible");
20
20 lines TYPESCRIPT