TestRedactSecretMultipleOccurrences asserts all occurrences are redacted, not just the first.
(t *testing.T)
| 27 | |
| 28 | // TestRedactSecretMultipleOccurrences asserts all occurrences are redacted, not just the first. |
| 29 | func TestRedactSecretMultipleOccurrences(t *testing.T) { |
| 30 | secret := "sk-secret-upstream-key-1234" |
| 31 | text := secret + " appears twice: " + secret |
| 32 | |
| 33 | got := RedactSecret(text, secret) |
| 34 | |
| 35 | masked := MaskAPIKey(secret) |
| 36 | want := masked + " appears twice: " + masked |
| 37 | if got != want { |
| 38 | t.Errorf("RedactSecret() = %q, want %q", got, want) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // TestRedactSecretEmptySecret asserts an empty secret leaves the text untouched |
| 43 | // (guards against strings.ReplaceAll's pathological behavior on an empty old value). |
nothing calls this directly
no test coverage detected