feat(f7.1): sequence-diagram parser (#22)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user