MCPcopy Index your code
hub / github.com/tbphp/gpt-load / TestRedactSecretMultipleOccurrences

Function TestRedactSecretMultipleOccurrences

internal/utils/string_utils_test.go:29–40  ·  view source on GitHub ↗

TestRedactSecretMultipleOccurrences asserts all occurrences are redacted, not just the first.

(t *testing.T)

Source from the content-addressed store, hash-verified

27
28// TestRedactSecretMultipleOccurrences asserts all occurrences are redacted, not just the first.
29func 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).

Callers

nothing calls this directly

Calls 2

RedactSecretFunction · 0.85
MaskAPIKeyFunction · 0.85

Tested by

no test coverage detected