| 507 | } |
| 508 | |
| 509 | func TestRunValidate_InvalidTasks(t *testing.T) { |
| 510 | // Test validation errors through the validator directly (runValidate calls os.Exit on errors). |
| 511 | v := validator.NewValidator(false) |
| 512 | tasks := []*model.Task{ |
| 513 | {ID: "001", Title: "Bad Task", Status: "banana", Priority: "mega", Effort: "tiny"}, |
| 514 | } |
| 515 | |
| 516 | result := v.Validate(tasks) |
| 517 | |
| 518 | if result.Errors == 0 { |
| 519 | t.Error("expected errors for invalid field values") |
| 520 | } |
| 521 | |
| 522 | errorMessages := make([]string, 0) |
| 523 | for _, issue := range result.Issues { |
| 524 | if issue.Level == validator.LevelError { |
| 525 | errorMessages = append(errorMessages, issue.Message) |
| 526 | } |
| 527 | } |
| 528 | if len(errorMessages) < 3 { |
| 529 | t.Errorf("expected at least 3 errors (status, priority, effort), got %d: %v", len(errorMessages), errorMessages) |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | func TestRunValidate_WithArchive(t *testing.T) { |
| 534 | tmpDir := t.TempDir() |