| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | import { proposedPlanTitle, stripDisplayedPlanMarkdown } from "./proposedPlanText.ts"; |
| 3 | |
| 4 | describe("proposedPlanTitle", () => { |
| 5 | it("reads the first markdown heading as the plan title", () => { |
| 6 | expect(proposedPlanTitle("# Integrate RPC\n\nBody")).toBe("Integrate RPC"); |
| 7 | }); |
| 8 | |
| 9 | it("returns null when the plan has no heading", () => { |
| 10 | expect(proposedPlanTitle("- step 1")).toBeNull(); |
| 11 | }); |
| 12 | }); |
| 13 | |
| 14 | describe("stripDisplayedPlanMarkdown", () => { |
| 15 | it("drops the leading title heading from displayed plan markdown", () => { |
| 16 | expect(stripDisplayedPlanMarkdown("# Integrate RPC\n\n## Summary\n\n- step 1\n")).toBe( |
| 17 | "- step 1", |
| 18 | ); |
| 19 | }); |
| 20 | |
| 21 | it("preserves non-summary headings after dropping the title heading", () => { |
| 22 | expect(stripDisplayedPlanMarkdown("# Integrate RPC\n\n## Scope\n\n- step 1\n")).toBe( |
| 23 | "## Scope\n\n- step 1", |
| 24 | ); |
| 25 | }); |
| 26 | }); |