(t *testing.T)
| 128 | } |
| 129 | |
| 130 | func TestMaskedAPIKey(t *testing.T) { |
| 131 | tests := []struct { |
| 132 | in, want string |
| 133 | }{ |
| 134 | {"", ""}, |
| 135 | {"short", "*****"}, |
| 136 | {"abcdefgh", "********"}, |
| 137 | {"abcdefghij", "abcd**ghij"}, |
| 138 | {"sk-1234567890abcdef", "sk-1***********cdef"}, |
| 139 | } |
| 140 | for _, tc := range tests { |
| 141 | tc := tc |
| 142 | t.Run(tc.in, func(t *testing.T) { |
| 143 | t.Parallel() |
| 144 | if got := providers.MaskedAPIKey(tc.in); got != tc.want { |
| 145 | t.Fatalf("MaskedAPIKey(%q) = %q, want %q", tc.in, got, tc.want) |
| 146 | } |
| 147 | }) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | func loadLegacyFileForTest(path string) (providers.File, error) { |
| 152 | data, err := os.ReadFile(path) |
nothing calls this directly
no test coverage detected