MCPcopy Create free account
hub / github.com/github/gh-aw / TestSanitizeErrorMessage_PascalCaseVariants

Function TestSanitizeErrorMessage_PascalCaseVariants

pkg/stringutil/sanitize_test.go:149–172  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func 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
174func TestSanitizeErrorMessage_EdgeCases(t *testing.T) {
175 tests := []struct {

Callers

nothing calls this directly

Calls 2

SanitizeErrorMessageFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected