(t *testing.T)
| 735 | } |
| 736 | |
| 737 | func TestFeedCommand_SourceWorklog(t *testing.T) { |
| 738 | resetFeedFlags() |
| 739 | feedSource = "worklog" |
| 740 | noColor = true |
| 741 | defer func() { noColor = false }() |
| 742 | |
| 743 | tmpDir := t.TempDir() |
| 744 | createWorklogFiles(t, tmpDir) |
| 745 | |
| 746 | oldTaskDir := taskDir |
| 747 | taskDir = tmpDir |
| 748 | defer func() { taskDir = oldTaskDir }() |
| 749 | |
| 750 | // Git log should NOT be called |
| 751 | oldGitLog := gitLogFunc |
| 752 | gitLogFunc = func(_ string, _ []string) (string, error) { |
| 753 | t.Fatal("git log should not be called with --source worklog") |
| 754 | return "", nil |
| 755 | } |
| 756 | defer func() { gitLogFunc = oldGitLog }() |
| 757 | |
| 758 | oldGitShow := gitShowFunc |
| 759 | gitShowFunc = noopGitShow |
| 760 | defer func() { gitShowFunc = oldGitShow }() |
| 761 | |
| 762 | output, err := captureFeedOutput(t, func() error { |
| 763 | return runFeed(feedCmd, nil) |
| 764 | }) |
| 765 | if err != nil { |
| 766 | t.Fatalf("unexpected error: %v", err) |
| 767 | } |
| 768 | |
| 769 | if !strings.Contains(output, "[Worklog]") { |
| 770 | t.Error("expected [Worklog] tag in output") |
| 771 | } |
| 772 | if !strings.Contains(output, "015") { |
| 773 | t.Error("expected task ID 015 in output") |
| 774 | } |
| 775 | if !strings.Contains(output, "Started implementation") { |
| 776 | t.Error("expected worklog message in output") |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | func TestFeedCommand_SourceGit(t *testing.T) { |
| 781 | resetFeedFlags() |
nothing calls this directly
no test coverage detected