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

Function TestFeedCommand_WorklogJSON

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

Source from the content-addressed store, hash-verified

828}
829
830func TestFeedCommand_WorklogJSON(t *testing.T) {
831 resetFeedFlags()
832 feedFormat = "json"
833 feedSource = "worklog"
834
835 tmpDir := t.TempDir()
836 createWorklogFiles(t, tmpDir)
837
838 oldTaskDir := taskDir
839 taskDir = tmpDir
840 defer func() { taskDir = oldTaskDir }()
841
842 oldGitShow := gitShowFunc
843 gitShowFunc = noopGitShow
844 defer func() { gitShowFunc = oldGitShow }()
845
846 output, err := captureFeedOutput(t, func() error {
847 return runFeed(feedCmd, nil)
848 })
849 if err != nil {
850 t.Fatalf("unexpected error: %v", err)
851 }
852
853 var entries []feed.FeedEntry
854 if err := json.Unmarshal([]byte(output), &entries); err != nil {
855 t.Fatalf("failed to parse JSON: %v\noutput: %s", err, output)
856 }
857
858 if len(entries) != 2 {
859 t.Fatalf("expected 2 entries, got %d", len(entries))
860 }
861 if entries[0].Source != "worklog" {
862 t.Errorf("expected source 'worklog', got %q", entries[0].Source)
863 }
864 if entries[0].TaskID != "015" {
865 t.Errorf("expected taskID '015', got %q", entries[0].TaskID)
866 }
867}
868
869func TestParseSinceTime(t *testing.T) {
870 // Absolute date

Callers

nothing calls this directly

Calls 4

resetFeedFlagsFunction · 0.85
createWorklogFilesFunction · 0.85
captureFeedOutputFunction · 0.85
runFeedFunction · 0.85

Tested by

no test coverage detected