feat: filter and search by tag
This commit is contained in:
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user