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

Function TestRunGet_DuplicateIDError

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

Source from the content-addressed store, hash-verified

310}
311
312func TestRunGet_DuplicateIDError(t *testing.T) {
313 tmpDir := createDuplicateTestFiles(t)
314 resetGetFlags()
315 taskDir = tmpDir
316
317 err := runGet(getCmd, []string{"042"})
318 if err == nil {
319 t.Fatal("expected error for duplicate ID, got nil")
320 }
321 if !strings.Contains(err.Error(), "duplicate task ID") {
322 t.Errorf("expected 'duplicate task ID' error, got: %v", err)
323 }
324 if !strings.Contains(err.Error(), "042") {
325 t.Errorf("expected error to mention ID 042, got: %v", err)
326 }
327 if !strings.Contains(err.Error(), "Task A") {
328 t.Errorf("expected error to mention title 'Task A', got: %v", err)
329 }
330 if !strings.Contains(err.Error(), "Task B") {
331 t.Errorf("expected error to mention title 'Task B', got: %v", err)
332 }
333}
334
335func TestRunGet_DuplicateID_UniqueTaskWorks(t *testing.T) {
336 tmpDir := createDuplicateTestFiles(t)

Callers

nothing calls this directly

Calls 4

createDuplicateTestFilesFunction · 0.85
resetGetFlagsFunction · 0.85
runGetFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected