fix: changed detected by scanner but no updated by render layer

This commit is contained in:
2026-02-03 11:34:24 +01:00
parent 01dcaf882a
commit 06ed2c3cbe
3 changed files with 35 additions and 1 deletions

View File

@ -211,3 +211,28 @@ func TestSQLiteStorage_SearchByTag(t *testing.T) {
t.Fatalf("expected tag match to be n2")
}
}
func TestSQLiteStorage_Create_Upsert(t *testing.T) {
st := newSQLiteStorage(t)
ts := time.Date(2026, 2, 3, 12, 0, 0, 0, time.UTC)
n := sampleNote("n1", "notes/alpha.md", "Alpha", "one", ts)
if err := st.Create(n); err != nil {
t.Fatalf("create note: %v", err)
}
n.Content = "updated"
n.Title = "Alpha Updated"
n.UpdatedAt = ts.Add(2 * time.Hour)
if err := st.Create(n); err != nil {
t.Fatalf("upsert note: %v", err)
}
got, err := st.Get("n1")
if err != nil {
t.Fatalf("get note: %v", err)
}
if got.Title != "Alpha Updated" || got.Content != "updated" {
t.Fatalf("expected note to be updated, got %+v", got)
}
}