96931f245d
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
932 B
TypeScript
25 lines
932 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { parseSequence } from "../src/mermaidSequenceDiff";
|
|
|
|
describe("parseSequence", () => {
|
|
it("captures explicit participants in order", () => {
|
|
const d = parseSequence("sequenceDiagram\n participant A\n participant B\n A->>B: hi");
|
|
expect(d.participants).toEqual(["A", "B"]);
|
|
});
|
|
|
|
it("captures message statements verbatim (trimmed)", () => {
|
|
const d = parseSequence("sequenceDiagram\n A->>B: hi\n B-->>A: bye");
|
|
expect(d.statements).toEqual(["A->>B: hi", "B-->>A: bye"]);
|
|
});
|
|
|
|
it("infers participants from messages when not declared", () => {
|
|
const d = parseSequence("sequenceDiagram\n A->>B: hi\n B->>C: on");
|
|
expect(d.participants).toEqual(["A", "B", "C"]);
|
|
});
|
|
|
|
it("ignores comments and blank lines", () => {
|
|
const d = parseSequence("sequenceDiagram\n%% note\n\n A->>B: hi");
|
|
expect(d.statements).toEqual(["A->>B: hi"]);
|
|
});
|
|
});
|