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

Function TestResolveTask_DuplicateIDError

apps/cli/internal/cli/duplicate_test.go:242–274  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

240}
241
242func TestResolveTask_DuplicateIDError(t *testing.T) {
243 tasks := []*model.Task{
244 {ID: "042", Title: "Task A", FilePath: "groupA/042-task-a.md"},
245 {ID: "042", Title: "Task B", FilePath: "groupB/042-task-b.md"},
246 {ID: "001", Title: "Unique Task", FilePath: "001-unique.md"},
247 }
248
249 _, err := resolveTask("042", tasks, true, 0.6)
250 if err == nil {
251 t.Fatal("expected error for duplicate ID, got nil")
252 }
253 if !strings.Contains(err.Error(), "duplicate task ID") {
254 t.Errorf("expected 'duplicate task ID' error, got: %v", err)
255 }
256 if !strings.Contains(err.Error(), "042") {
257 t.Errorf("expected error to mention ID 042, got: %v", err)
258 }
259 if !strings.Contains(err.Error(), "Task A") {
260 t.Errorf("expected error to mention title 'Task A', got: %v", err)
261 }
262 if !strings.Contains(err.Error(), "Task B") {
263 t.Errorf("expected error to mention title 'Task B', got: %v", err)
264 }
265 if !strings.Contains(err.Error(), "groupA/042-task-a.md") {
266 t.Errorf("expected error to mention file path, got: %v", err)
267 }
268 if !strings.Contains(err.Error(), "groupB/042-task-b.md") {
269 t.Errorf("expected error to mention file path, got: %v", err)
270 }
271 if !strings.Contains(err.Error(), "taskmd deduplicate") {
272 t.Errorf("expected error to mention deduplicate command, got: %v", err)
273 }
274}
275
276func TestResolveTask_DuplicateIDError_ByTitle(t *testing.T) {
277 tasks := []*model.Task{

Callers

nothing calls this directly

Calls 2

resolveTaskFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected