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

Function TestFeedCommand_CompletedStatus

apps/cli/internal/cli/feed_test.go:468–505  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

466}
467
468func TestFeedCommand_CompletedStatus(t *testing.T) {
469 resetFeedFlags()
470 noColor = true
471 defer func() { noColor = false }()
472
473 oldGitLog := gitLogFunc
474 gitLogFunc = func(_ string, _ []string) (string, error) {
475 return sampleGitLogOutput, nil
476 }
477 defer func() { gitLogFunc = oldGitLog }()
478
479 oldGitShow := gitShowFunc
480 gitShowFunc = func(hash, path string) (string, error) {
481 if strings.Contains(path, "042") {
482 if strings.HasSuffix(hash, "^") {
483 return "---\nid: 042\ntitle: Add Auth\nstatus: in-progress\n---\n# Task", nil
484 }
485 return "---\nid: 042\ntitle: Add Auth\nstatus: completed\n---\n# Task", nil
486 }
487 return "", fmt.Errorf("not found")
488 }
489 defer func() { gitShowFunc = oldGitShow }()
490
491 output, err := captureFeedOutput(t, func() error {
492 return runFeed(feedCmd, nil)
493 })
494 if err != nil {
495 t.Fatalf("unexpected error: %v", err)
496 }
497
498 // Rich diff shows status transition as compact summary
499 if !strings.Contains(output, "status in-progress") || !strings.Contains(output, "completed") {
500 t.Error("expected status transition in output")
501 }
502 if !strings.Contains(output, "[Added]") {
503 t.Error("expected [Added] tag for task 043")
504 }
505}
506
507func TestFeedCommand_CancelledStatus(t *testing.T) {
508 resetFeedFlags()

Callers

nothing calls this directly

Calls 4

resetFeedFlagsFunction · 0.85
captureFeedOutputFunction · 0.85
runFeedFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected