(t *testing.T)
| 706 | } |
| 707 | |
| 708 | func 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 |
nothing calls this directly
no test coverage detected