(t *testing.T)
| 308 | } |
| 309 | |
| 310 | func TestSanitizeCredentialHint(t *testing.T) { |
| 311 | t.Parallel() |
| 312 | |
| 313 | tests := []struct { |
| 314 | name string |
| 315 | input string |
| 316 | expected string |
| 317 | }{ |
| 318 | {"valid_short", "s...t", "s...t"}, |
| 319 | {"valid_long", "sk-a...efgh", "sk-a...efgh"}, |
| 320 | {"valid_only_dots", "...", "..."}, |
| 321 | {"empty", "", ""}, |
| 322 | {"short_unmasked_secret", "abc12", "..."}, |
| 323 | {"missing_dots", "sk-abcdefgh", "..."}, |
| 324 | {"too_long", "sk-a...efghijklmn", "..."}, |
| 325 | {"raw_secret", "sk-proj-abc123xyz789", "..."}, |
| 326 | } |
| 327 | |
| 328 | for _, tc := range tests { |
| 329 | t.Run(tc.name, func(t *testing.T) { |
| 330 | t.Parallel() |
| 331 | require.Equal(t, tc.expected, sanitizeCredentialHint(tc.input)) |
| 332 | }) |
| 333 | } |
| 334 | } |
nothing calls this directly
no test coverage detected