| import { describe, expect, it } from "vitest"; | |
| import { splitResponseShellMarkdown } from "./responseShellMarkdown"; | |
| describe("splitResponseShellMarkdown", () => { | |
| it("splits Result/Why/Next action sections", () => { | |
| const input = [ | |
| "**Result**", | |
| "The main answer.", | |
| "", | |
| "**Why**", | |
| "- Reason one", | |
| "- Reason two", | |
| "", | |
| "**Next action**", | |
| "- Follow-up", | |
| ].join("\n"); | |
| const out = splitResponseShellMarkdown(input); | |
| expect(out.hasShell).toBe(true); | |
| expect(out.result).toContain("The main answer."); | |
| expect(out.why).toContain("Reason one"); | |
| expect(out.nextAction).toContain("Follow-up"); | |
| expect(out.rest).toBe(""); | |
| }); | |
| it("falls back when no shell headings are present", () => { | |
| const out = splitResponseShellMarkdown("Plain markdown content only."); | |
| expect(out.hasShell).toBe(false); | |
| expect(out.result).toBe("Plain markdown content only."); | |
| expect(out.why).toBe(""); | |
| expect(out.nextAction).toBe(""); | |
| }); | |
| }); | |