import { extractApplicationAnswerDraft, removeApplicationAnswerDraft, upsertApplicationAnswerDraft, } from "./applicationDrafts"; test("application answer helpers keep human notes separate", () => { const stored = upsertApplicationAnswerDraft("Human note", " Draft answer "); expect(stored).toBe("Human note\n\n<<>>\nDraft answer\n<<>>"); expect(extractApplicationAnswerDraft(stored)).toBe("Draft answer"); expect(removeApplicationAnswerDraft(stored)).toBe("Human note"); }); test("clearing an answer retains human notes and removes all marker blocks", () => { const duplicated = "Human note\n\n<<>>\nFirst\n<<>>\n\n<<>>\nSecond\n<<>>"; expect(upsertApplicationAnswerDraft(duplicated, "")).toBe("Human note"); }); test("legacy application answer labels remain readable during migration", () => { const legacy = "Human note\n\nApplication answer draft:\nLegacy answer"; expect(extractApplicationAnswerDraft(legacy)).toBe("Legacy answer"); expect(removeApplicationAnswerDraft(legacy)).toBe("Human note"); });