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

Function TestRunValidate_InvalidTasks

apps/cli/internal/cli/validate_test.go:509–531  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

507}
508
509func 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
533func TestRunValidate_WithArchive(t *testing.T) {
534 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 2

ValidateMethod · 0.95
ErrorMethod · 0.80

Tested by

no test coverage detected