返回 DeepSeek-Reasonix
decision-surface-remote.test.ts
根目录 / desktop / frontend / src / __tests__ / decision-surface-remote.test.ts
1 // Run: tsx src/__tests__/decision-surface-remote.test.ts
2 import assert from "node:assert/strict";
3 import { projectDecisionSurface } from "../app-runtime/decisionSurfaceProjection";
4
5 const base = { approval: undefined, ask: undefined, mcpInteraction: undefined, extensionForm: undefined, workspaceConflict: null, pendingClose: null, clearContextPending: false } as unknown as Parameters<typeof projectDecisionSurface>[0];
6 const ask = { id: "1", questions: [{ id: "q1", prompt: "?", options: [{ label: "a" }, { label: "b" }] }] } as unknown as Parameters<typeof projectDecisionSurface>[0]["ask"];
7 const approval = { id: "call-1", tool: "bash" } as unknown as Parameters<typeof projectDecisionSurface>[0]["approval"];
8
9 assert.equal(projectDecisionSurface({ ...base, ask }), "ask", "a local ask docks in the footer");
10 assert.equal(projectDecisionSurface({ ...base, ask, remote: true }), null, "a remote ask belongs to the remote surface, not a second footer card");
11 assert.equal(projectDecisionSurface({ ...base, approval, remote: true }), null, "a remote approval is not duplicated in the footer");
12 assert.equal(projectDecisionSurface({ ...base, ask, remote: true, clearContextPending: true }), "clear_context", "shell decisions still reach the footer on a remote tab");
13 console.log("decision-surface-remote: 4 passed");
14
14 lines TYPESCRIPT