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

Function TestValidate_ComplexScenario

sdk/go/validator/validator_test.go:510–576  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

508}
509
510func TestValidate_ComplexScenario(t *testing.T) {
511 // Create a complex scenario with multiple issues
512 tasks := []*model.Task{
513 {
514 // Valid task
515 ID: "001",
516 Title: "Valid Task",
517 Status: model.StatusPending,
518 Priority: model.PriorityHigh,
519 Effort: model.EffortSmall,
520 },
521 {
522 // Missing title
523 ID: "002",
524 },
525 {
526 // Invalid status
527 ID: "003",
528 Title: "Task 3",
529 Status: "wrong",
530 },
531 {
532 // Duplicate ID with task 001
533 ID: "001",
534 Title: "Duplicate",
535 FilePath: "/path/duplicate.md",
536 },
537 {
538 // Missing dependency
539 ID: "004",
540 Title: "Task 4",
541 Dependencies: []string{"999"},
542 },
543 {
544 // Part of circular dependency
545 ID: "005",
546 Title: "Task 5",
547 Dependencies: []string{"006"},
548 },
549 {
550 // Part of circular dependency
551 ID: "006",
552 Title: "Task 6",
553 Dependencies: []string{"005"},
554 },
555 }
556
557 v := NewValidator(false)
558 result := v.Validate(tasks)
559
560 // Should have multiple errors:
561 // - Missing title (002)
562 // - Invalid status (003)
563 // - Duplicate ID (001)
564 // - Missing dependency (004)
565 // - Circular dependency (005/006)
566 if result.Errors < 4 {
567 t.Errorf("Expected at least 4 errors, got %d", result.Errors)

Callers

nothing calls this directly

Calls 4

ValidateMethod · 0.95
NewValidatorFunction · 0.85
ErrorMethod · 0.80
IsValidMethod · 0.45

Tested by

no test coverage detected