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

Function TestValidateConfig_WithScopes

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

Source from the content-addressed store, hash-verified

706}
707
708func TestValidateConfig_WithScopes(t *testing.T) {
709 v := validator.NewValidator(false)
710 tasks := []*model.Task{
711 {ID: "001", Title: "Test Task", Touches: []string{"cli/graph", "bad-scope"}},
712 }
713 validationResult := &validator.ValidationResult{
714 Issues: make([]validator.ValidationIssue, 0),
715 TaskCount: 1,
716 }
717
718 configData := &validator.ConfigData{
719 Scopes: map[string]validator.ScopeConfig{
720 "cli/graph": {Description: "Graph", Paths: []string{"apps/cli/internal/graph/"}},
721 },
722 TopKeys: []string{"scopes"},
723 ConfigPath: ".taskmd.yaml",
724 }
725
726 // Merge config validation
727 mergeValidationResults(validationResult, v.ValidateConfig(configData))
728
729 // Merge touches validation
730 knownScopes := make(map[string]bool, len(configData.Scopes))
731 for name := range configData.Scopes {
732 knownScopes[name] = true
733 }
734 mergeValidationResults(validationResult, v.ValidateTouchesAgainstScopes(tasks, knownScopes))
735
736 // Should warn about "bad-scope"
737 found := false
738 for _, issue := range validationResult.Issues {
739 if strings.Contains(issue.Message, "bad-scope") {
740 found = true
741 break
742 }
743 }
744 if !found {
745 t.Error("expected warning about 'bad-scope' touches referencing undefined scope")
746 }
747}
748
749// --- parseIDConfig tests ---
750

Callers

nothing calls this directly

Calls 4

ValidateConfigMethod · 0.95
mergeValidationResultsFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected