aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/data/get_test.go
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2025-08-05 12:40:15 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2025-08-05 12:40:15 -0400
commit10d5e4db7ad9fe9855a19977f7bc037b058bfead (patch)
tree478789f87c32d0b9f04f5887acae90b44dfe3da7 /pkg/data/get_test.go
parent62aeb1a0fb0a239f6193b7cb872787578480082c (diff)
Add headings to db serializer and deserializer
Diffstat (limited to 'pkg/data/get_test.go')
-rw-r--r--pkg/data/get_test.go11
1 files changed, 7 insertions, 4 deletions
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": {