(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestMaskSecret(t *testing.T) { |
| 12 | t.Parallel() |
| 13 | |
| 14 | tests := []struct { |
| 15 | name string |
| 16 | input string |
| 17 | expected string |
| 18 | }{ |
| 19 | {"empty", "", ""}, |
| 20 | {"single_char", "x", "..."}, |
| 21 | {"two_chars", "ab", "..."}, |
| 22 | {"four_chars", "abcd", "..."}, |
| 23 | {"short", "short", "s...t"}, |
| 24 | {"short_9_chars", "veryshort", "v...t"}, |
| 25 | {"medium_15_chars", "thisisquitelong", "th...ng"}, |
| 26 | {"long_api_key", "sk-ant-api03-abcdefgh", "sk-a...efgh"}, |
| 27 | {"unicode", "hélloworld🌍!", "hé...🌍!"}, |
| 28 | {"github_token", "ghp_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgh", "ghp_...efgh"}, |
| 29 | } |
| 30 | |
| 31 | for _, tc := range tests { |
| 32 | t.Run(tc.name, func(t *testing.T) { |
| 33 | t.Parallel() |
| 34 | assert.Equal(t, tc.expected, utils.MaskSecret(tc.input)) |
| 35 | }) |
| 36 | } |
| 37 | } |
nothing calls this directly
no test coverage detected