(t *testing.T)
| 324 | } |
| 325 | |
| 326 | func TestFeedCommand_EmptyFeed_JSON(t *testing.T) { |
| 327 | resetFeedFlags() |
| 328 | feedFormat = "json" |
| 329 | |
| 330 | oldGitLog := gitLogFunc |
| 331 | gitLogFunc = func(_ string, _ []string) (string, error) { |
| 332 | return "", nil |
| 333 | } |
| 334 | defer func() { gitLogFunc = oldGitLog }() |
| 335 | |
| 336 | oldGitShow := gitShowFunc |
| 337 | gitShowFunc = noopGitShow |
| 338 | defer func() { gitShowFunc = oldGitShow }() |
| 339 | |
| 340 | output, err := captureFeedOutput(t, func() error { |
| 341 | return runFeed(feedCmd, nil) |
| 342 | }) |
| 343 | if err != nil { |
| 344 | t.Fatalf("unexpected error: %v", err) |
| 345 | } |
| 346 | |
| 347 | if strings.TrimSpace(output) != "[]" { |
| 348 | t.Errorf("expected empty JSON array, got: %s", output) |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | func TestFeedCommand_InvalidFormat(t *testing.T) { |
| 353 | resetFeedFlags() |
nothing calls this directly
no test coverage detected