A notes and TODOs app built on atproto
Something went wrong. Try again.
1234567891011121314151617181920212223import { describe, expect, it } from "vitest";import { parseMarkdownBlocks, prefixMarkdownLines, toggleMarkdownCheckbox } from "./markdown";
describe("Markdown note helpers", () => { it("recognizes headings, lists, and task-list items", () => { expect(parseMarkdownBlocks("# Plan\n- point\n- [ ] first\n- [x] done").map(({ kind, checked }) => ({ kind, checked }))).toEqual([ { kind: "heading", checked: undefined }, { kind: "unordered", checked: undefined }, { kind: "check", checked: false }, { kind: "check", checked: true }, ]); });
it("toggles a checkbox without changing the rest of the Markdown", () => { expect(toggleMarkdownCheckbox("Before\n- [ ] ship it\nAfter", 1)).toBe("Before\n- [x] ship it\nAfter"); expect(toggleMarkdownCheckbox("- [X] ship it", 0)).toBe("- [ ] ship it"); });
it("prefixes every selected line for toolbar formatting", () => { expect(prefixMarkdownLines("one\ntwo", 0, 7, "- ").value).toBe("- one\n- two"); });});