(t *testing.T)
| 778 | } |
| 779 | |
| 780 | func TestFeedCommand_SourceGit(t *testing.T) { |
| 781 | resetFeedFlags() |
| 782 | feedSource = "git" |
| 783 | noColor = true |
| 784 | defer func() { noColor = false }() |
| 785 | |
| 786 | oldGitLog := gitLogFunc |
| 787 | gitLogFunc = func(_ string, _ []string) (string, error) { |
| 788 | return sampleGitLogOutput, nil |
| 789 | } |
| 790 | defer func() { gitLogFunc = oldGitLog }() |
| 791 | |
| 792 | oldGitShow := gitShowFunc |
| 793 | gitShowFunc = noopGitShow |
| 794 | defer func() { gitShowFunc = oldGitShow }() |
| 795 | |
| 796 | output, err := captureFeedOutput(t, func() error { |
| 797 | return runFeed(feedCmd, nil) |
| 798 | }) |
| 799 | if err != nil { |
| 800 | t.Fatalf("unexpected error: %v", err) |
| 801 | } |
| 802 | |
| 803 | if strings.Contains(output, "[Worklog]") { |
| 804 | t.Error("expected no [Worklog] tag with --source git") |
| 805 | } |
| 806 | if !strings.Contains(output, "Alice") { |
| 807 | t.Error("expected git entries in output") |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | func TestFeedCommand_InvalidSource(t *testing.T) { |
| 812 | resetFeedFlags() |
nothing calls this directly
no test coverage detected