From 10d5e4db7ad9fe9855a19977f7bc037b058bfead Mon Sep 17 00:00:00 2001 From: JP Appel Date: Tue, 5 Aug 2025 12:40:15 -0400 Subject: Add headings to db serializer and deserializer --- pkg/data/get_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'pkg/data/get_test.go') diff --git a/pkg/data/get_test.go b/pkg/data/get_test.go index 9ee8a2a..4cadc76 100644 --- a/pkg/data/get_test.go +++ b/pkg/data/get_test.go @@ -15,8 +15,8 @@ func singleDoc(t *testing.T) *sql.DB { db := data.NewMemDB("test") if _, err := db.Exec(` - INSERT INTO Documents (path, title, date, fileTime) - VALUES ("/file", "A file", 1, 2) + INSERT INTO Documents (path, title, date, fileTime, headings) + VALUES ("/file", "A file", 1, 2, '# A Heading' || CHAR(10)) `); err != nil { t.Fatal("err inserting doc:", err) } @@ -71,8 +71,9 @@ func multiDoc(t *testing.T) *sql.DB { db := data.NewMemDB("test") if _, err := db.Exec(` - INSERT INTO Documents (path, title, date, fileTime) - VALUES ("/notes/anote.md", "A note", 1, 2), ("README.md", "read this file!", 3, 4) + INSERT INTO Documents (path, title, date, fileTime, headings) + VALUES ("/notes/anote.md", "A note", 1, 2, '#Top Level' || CHAR(10) || '## Second Level' || CHAR(10)), + ("README.md", "read this file!", 3, 4, NULL) `); err != nil { t.Fatal("err inserting doc:", err) } @@ -143,6 +144,7 @@ func TestFill_Get(t *testing.T) { Authors: []string{"jp"}, Tags: []string{"foo", "bar", "oof", "baz"}, Links: []string{"link1", "link2"}, + Headings: "# A Heading\n", }, nil, }, @@ -186,6 +188,7 @@ func TestFillMany_Get(t *testing.T) { FileTime: time.Unix(2, 0), Authors: []string{"jp"}, Tags: []string{"foo", "baz"}, + Headings: "#Top Level\n## Second Level\n", Links: []string{"/home"}, }, "README.md": { -- cgit v1.2.3