(t *testing.T)
| 172 | } |
| 173 | |
| 174 | func TestSanitizeErrorMessage_EdgeCases(t *testing.T) { |
| 175 | tests := []struct { |
| 176 | name string |
| 177 | message string |
| 178 | expected string |
| 179 | }{ |
| 180 | { |
| 181 | name: "very long message", |
| 182 | message: "Error: " + strings.Repeat("MY_SECRET_KEY ", 100), |
| 183 | expected: "Error: " + strings.Repeat("[REDACTED] ", 100), |
| 184 | }, |
| 185 | { |
| 186 | name: "only secrets", |
| 187 | message: "API_KEY DATABASE_PASSWORD GitHubToken", |
| 188 | expected: "[REDACTED] [REDACTED] [REDACTED]", |
| 189 | }, |
| 190 | { |
| 191 | name: "secrets at start and end", |
| 192 | message: "MY_API_KEY in the middle DATABASE_SECRET", |
| 193 | expected: "[REDACTED] in the middle [REDACTED]", |
| 194 | }, |
| 195 | { |
| 196 | name: "secret with numbers", |
| 197 | message: "Error with API_KEY_V2 and SECRET_123", |
| 198 | expected: "Error with [REDACTED] and [REDACTED]", |
| 199 | }, |
| 200 | } |
| 201 | |
| 202 | for _, tt := range tests { |
| 203 | t.Run(tt.name, func(t *testing.T) { |
| 204 | result := SanitizeErrorMessage(tt.message) |
| 205 | assertSanitizeResult(t, "SanitizeErrorMessage", tt.message, result, tt.expected) |
| 206 | }) |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | func TestSanitizeErrorMessage_GhAwVariables(t *testing.T) { |
| 211 | tests := []struct { |
nothing calls this directly
no test coverage detected