Keep investigation graphs stable during updates, defer expensive chart rendering, and prevent stale results when switching tasks. Adopt reference annotations and consolidate frontend documentation.
27 lines
1.5 KiB
TypeScript
27 lines
1.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { investigationDiagramSchema } from "../api/investigation-report";
|
|
import { styleInvestigationDiagram } from "./investigation-diagram-style";
|
|
|
|
describe("investigation diagrams as process references", () => {
|
|
it("reads a legacy running node as a neutral reference without suggesting live execution", () => {
|
|
const diagram = investigationDiagramSchema.parse({ title: "流程参考", mermaid: "flowchart TD\nA[核查]",
|
|
node_refs: [{ node_id: "A", label: "核查", status: "running" }] });
|
|
const styled = styleInvestigationDiagram(diagram);
|
|
expect(styled).toContain("class A tjReference;");
|
|
expect(diagram.node_refs[0].status).toBe("reference");
|
|
expect(styled).not.toContain("class A tjRunning;");
|
|
expect(styled).not.toContain("class A tjRecordedRunning;");
|
|
});
|
|
|
|
it("distinguishes a recorded finding from task completion and preserves failed paths", () => {
|
|
const diagram = investigationDiagramSchema.parse({ title: "调查脉络", mermaid: "flowchart TD\nA[原尝试] --> B[替代路线]",
|
|
node_refs: [{ node_id: "A", label: "原尝试", status: "failed", detail: "接口超时" },
|
|
{ node_id: "B", label: "替代路线", status: "recorded" }] });
|
|
const styled = styleInvestigationDiagram(diagram);
|
|
expect(styled).toContain("class A tjFailed;");
|
|
expect(styled).toContain("class B tjRecorded;");
|
|
expect(styled.startsWith(diagram.mermaid)).toBe(true);
|
|
expect(diagram.node_refs[0].detail).toBe("接口超时");
|
|
});
|
|
});
|