(t *testing.T)
| 147 | } |
| 148 | |
| 149 | func TestSanitizeErrorMessage_PascalCaseVariants(t *testing.T) { |
| 150 | tests := []struct { |
| 151 | name string |
| 152 | message string |
| 153 | shouldRedact bool |
| 154 | }{ |
| 155 | {"Token suffix", "Invalid GitHubToken", true}, |
| 156 | {"Key suffix", "Missing ApiKey", true}, |
| 157 | {"Secret suffix", "Bad DeploySecret", true}, |
| 158 | {"Password suffix", "Wrong DatabasePassword", true}, |
| 159 | {"Credential suffix", "Invalid AwsCredential", true}, |
| 160 | {"Auth suffix", "Failed BasicAuth", true}, |
| 161 | {"No suffix", "Invalid GitHubActions", false}, |
| 162 | {"lowercase", "Invalid githubtoken", false}, |
| 163 | } |
| 164 | |
| 165 | for _, tt := range tests { |
| 166 | t.Run(tt.name, func(t *testing.T) { |
| 167 | result := SanitizeErrorMessage(tt.message) |
| 168 | containsRedacted := strings.Contains(result, "[REDACTED]") |
| 169 | assert.Equal(t, tt.shouldRedact, containsRedacted, "SanitizeErrorMessage(%q) redaction state should match expectation", tt.message) |
| 170 | }) |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | func TestSanitizeErrorMessage_EdgeCases(t *testing.T) { |
| 175 | tests := []struct { |
nothing calls this directly
no test coverage detected