(t *testing.T)
| 269 | } |
| 270 | |
| 271 | func 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 | |
| 301 | func TestFeedCommand_EmptyFeed(t *testing.T) { |
| 302 | resetFeedFlags() |
nothing calls this directly
no test coverage detected