Masters-four-Tab-OpenAI / frontend /src /utils /responseShellMarkdown.test.ts
Pete Dunn
chore: commit remaining UI polish, tests, and release gate artifacts
6132f30
Raw
History Blame Contribute Delete
1.02 kB
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("");
});
});