MCPcopy Index your code
hub / github.com/coder/coder / TestMaskSecret

Function TestMaskSecret

aibridge/utils/mask_test.go:11–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func 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}

Callers

nothing calls this directly

Calls 3

MaskSecretFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected