feat: filter and search by tag

This commit is contained in:
2026-02-03 09:53:08 +01:00
parent cb11e34798
commit 229223f77a
9 changed files with 147 additions and 14 deletions

View File

@ -51,3 +51,20 @@ func TestNoteStorageGetUpdate(t *testing.T) {
t.Errorf("Updating a note should reflect it in storage. Wanted '%s', got '%s'\n", n1.Content, nn2.Content)
}
}
func TestNoteStorageSearch_Tags(t *testing.T) {
ns = NewNoteStorage()
n := note.NewNote()
n.Path = "note3.md"
n.ID = note.GenerateNoteID(n.Path)
n.Content = "no tag here"
n.Tags = []string{"devops", "go"}
ns.Create(n)
results := ns.Search("go")
if len(results) != 1 {
t.Fatalf("expected 1 result, got %d", len(results))
}
}