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

Function TestFeedCommand_SourceWorklog

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

Source from the content-addressed store, hash-verified

735}
736
737func 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
780func TestFeedCommand_SourceGit(t *testing.T) {
781 resetFeedFlags()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected