(t *testing.T)
| 373 | } |
| 374 | |
| 375 | func TestFeedCommand_NonGitRepo(t *testing.T) { |
| 376 | resetFeedFlags() |
| 377 | |
| 378 | oldGitLog := gitLogFunc |
| 379 | gitLogFunc = func(_ string, _ []string) (string, error) { |
| 380 | return "", fmt.Errorf("not a git repository") |
| 381 | } |
| 382 | defer func() { gitLogFunc = oldGitLog }() |
| 383 | |
| 384 | oldGitShow := gitShowFunc |
| 385 | gitShowFunc = noopGitShow |
| 386 | defer func() { gitShowFunc = oldGitShow }() |
| 387 | |
| 388 | err := runFeed(feedCmd, nil) |
| 389 | if err == nil { |
| 390 | t.Fatal("expected error for non-git repo") |
| 391 | } |
| 392 | if !strings.Contains(err.Error(), "git repository") { |
| 393 | t.Errorf("expected git repository error, got: %v", err) |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | func TestExtractTaskIDFromPath(t *testing.T) { |
| 398 | tests := []struct { |
nothing calls this directly
no test coverage detected