MCPcopy Create free account
hub / github.com/driangle/taskmd / TestSearch_MatchInBody

Function TestSearch_MatchInBody

apps/cli/internal/cli/search_test.go:139–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

137}
138
139func TestSearch_MatchInBody(t *testing.T) {
140 resetSearchFlags()
141
142 tasks := []*model.Task{
143 {ID: "001", Title: "Task one", Status: model.StatusPending, Priority: model.PriorityMedium, Body: "Contains the keyword deployment here"},
144 {ID: "002", Title: "Task two", Status: model.StatusPending, Priority: model.PriorityLow, Body: "Nothing relevant"},
145 }
146
147 results := search.Search(tasks, "deployment")
148
149 if len(results) != 1 {
150 t.Fatalf("expected 1 result, got %d", len(results))
151 }
152 if results[0].ID != "001" {
153 t.Errorf("expected task 001, got %s", results[0].ID)
154 }
155 if results[0].MatchLocation != "body" {
156 t.Errorf("expected match location 'body', got %s", results[0].MatchLocation)
157 }
158}
159
160func TestSearch_CaseInsensitive(t *testing.T) {
161 resetSearchFlags()

Callers

nothing calls this directly

Calls 1

resetSearchFlagsFunction · 0.85

Tested by

no test coverage detected