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

Function TestFeedCommand_Scope

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

Source from the content-addressed store, hash-verified

269}
270
271func TestFeedCommand_Scope(t *testing.T) {
272 resetFeedFlags()
273 feedScope = "cli"
274
275 var capturedArgs []string
276 oldGitLog := gitLogFunc
277 gitLogFunc = func(_ string, args []string) (string, error) {
278 capturedArgs = args
279 return "", nil
280 }
281 defer func() { gitLogFunc = oldGitLog }()
282
283 oldGitShow := gitShowFunc
284 gitShowFunc = noopGitShow
285 defer func() { gitShowFunc = oldGitShow }()
286
287 _, err := captureFeedOutput(t, func() error {
288 return runFeed(feedCmd, nil)
289 })
290 if err != nil {
291 t.Fatalf("unexpected error: %v", err)
292 }
293
294 // The last arg should be the path glob containing the scope
295 lastArg := capturedArgs[len(capturedArgs)-1]
296 if !strings.Contains(lastArg, "cli") {
297 t.Errorf("expected scope 'cli' in path glob, got: %s", lastArg)
298 }
299}
300
301func TestFeedCommand_EmptyFeed(t *testing.T) {
302 resetFeedFlags()

Callers

nothing calls this directly

Calls 3

resetFeedFlagsFunction · 0.85
captureFeedOutputFunction · 0.85
runFeedFunction · 0.85

Tested by

no test coverage detected