Skip to content
Source
Sign inSign up
fuko/trytanstackdb-v2
Open History to see the last commit

note-body.test.ts

18 lines659 Bytes

1import { expect, test } from "vite-plus/test";
2​
3import { noteSnippet, parseNoteBody } from "./note-body";
4​
5test("parseNoteBody", () => {
6 expect(parseNoteBody("Intro\n# Goals\n- one\n[ ] todo\n[x] done\n\n")).toEqual([
7 { type: "paragraph", text: "Intro" },
8 { type: "heading", text: "Goals" },
9 { type: "bullet", text: "one" },
10 { type: "checklist", text: "todo", checked: false },
11 { type: "checklist", text: "done", checked: true },
12 ]);
13});
14​
15test("noteSnippet uses the first block without its marker", () => {
16 expect(noteSnippet("[ ] Passport\n[ ] Chargers")).toBe("Passport");
17 expect(noteSnippet("")).toBe("No additional text");
18});