(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestComputeScope(t *testing.T) { |
| 72 | tests := []struct { |
| 73 | name string |
| 74 | files []string |
| 75 | want string |
| 76 | }{ |
| 77 | {"no files", nil, "unknown"}, |
| 78 | {"single file", []string{"cmd/hooks.go"}, "single-file"}, |
| 79 | {"same package", []string{"cmd/hooks.go", "cmd/intent.go"}, "package"}, |
| 80 | {"cross-cutting", []string{"cmd/hooks.go", "watch/daemon.go", "mcp/main.go"}, "cross-cutting"}, |
| 81 | {"root files same package", []string{"main.go", "helpers.go"}, "package"}, |
| 82 | } |
| 83 | |
| 84 | for _, tt := range tests { |
| 85 | t.Run(tt.name, func(t *testing.T) { |
| 86 | got := computeScope(tt.files) |
| 87 | if got != tt.want { |
| 88 | t.Errorf("computeScope(%v) = %q, want %q", tt.files, got, tt.want) |
| 89 | } |
| 90 | }) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestAnalyzeRisk_NoHubs(t *testing.T) { |
| 95 | info := &hubInfo{ |
nothing calls this directly
no test coverage detected