diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-08-10 02:30:00 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-08-10 02:42:41 -0400 |
| commit | 5d0b36cf87ee94c690d11c0beab48f4dadc6fc52 (patch) | |
| tree | 8459c2e484c4f91019ea4b4999de3516dac6488f /pkg/data/update_test.go | |
| parent | 7b798789897bd07b03510e073f41e8deadbc460c (diff) | |
Change db schema; remove aliases, add fts5 integration
Greatly simplify db schema by removing alias functionality.
Create fts5 tables for text search over paths, headings, titles, meta,
authors, and links.
Diffstat (limited to 'pkg/data/update_test.go')
| -rw-r--r-- | pkg/data/update_test.go | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/pkg/data/update_test.go b/pkg/data/update_test.go index dc2365b..c4c1ed4 100644 --- a/pkg/data/update_test.go +++ b/pkg/data/update_test.go @@ -5,6 +5,7 @@ import ( "database/sql" "errors" "maps" + "slices" "testing" "time" @@ -265,8 +266,53 @@ func TestUpdateMany_Update(t *testing.T) { return a.Equal(*b) }) { t.Error("Got different docs than expected") - t.Logf("Got:\n%+v\n", docs) - t.Logf("Want:\n%+v\n", tt.docs) + if len(docs) != len(tt.docs) { + t.Logf("Wanted %d docs, got %d", len(tt.docs), len(docs)) + } + + for path, wantDoc := range tt.docs { + gotDoc, ok := docs[path] + if !ok { + t.Logf("Wanted doc at %s but did not recieve it", path) + continue + } else if wantDoc.Equal(*gotDoc) { + continue + } + + t.Log("Doc: ", path) + if wantDoc.Title != gotDoc.Title { + t.Log("want Title:", wantDoc.Title) + t.Log("Got Title:", gotDoc.Title) + } + if !wantDoc.Date.Equal(gotDoc.Date) { + t.Log("want Date:", wantDoc.Date) + t.Log("got Date:", gotDoc.Date) + } + if !wantDoc.FileTime.Equal(gotDoc.FileTime) { + t.Log("want filetime:", wantDoc.FileTime) + t.Log("got filetime:", gotDoc.FileTime) + } + if !slices.Equal(wantDoc.Authors, gotDoc.Authors) { + t.Log("want authors:", wantDoc.Authors) + t.Log("got authors:", gotDoc.Authors) + } + if !slices.Equal(wantDoc.Tags, gotDoc.Tags) { + t.Log("want tags:", wantDoc.Tags) + t.Log("got tags:", gotDoc.Tags) + } + if !slices.Equal(wantDoc.Links, gotDoc.Links) { + t.Log("want links:", wantDoc.Links) + t.Log("got links:", gotDoc.Links) + } + if wantDoc.Headings != gotDoc.Headings { + t.Log("want headings:", wantDoc.Headings) + t.Log("got headings:", gotDoc.Headings) + } + if wantDoc.OtherMeta != gotDoc.OtherMeta { + t.Log("want meta:", wantDoc.OtherMeta) + t.Log("got meta:", gotDoc.OtherMeta) + } + } } }) } |
