(t *testing.T)
| 200 | } |
| 201 | |
| 202 | func TestContainsPrefixed(t *testing.T) { |
| 203 | tcs := []struct { |
| 204 | name string |
| 205 | prefixes []string |
| 206 | v string |
| 207 | want bool |
| 208 | }{ |
| 209 | { |
| 210 | name: "empty", |
| 211 | v: "some-service-account-name", |
| 212 | want: false, |
| 213 | }, |
| 214 | { |
| 215 | name: "notFound", |
| 216 | v: "some-service-account-name", |
| 217 | prefixes: []string{"service-account-name", "other-service-account-name"}, |
| 218 | want: false, |
| 219 | }, |
| 220 | { |
| 221 | name: "one", |
| 222 | v: "some-service-account-name", |
| 223 | prefixes: []string{"service-account-name", "some-service-account-name"}, |
| 224 | want: true, |
| 225 | }, |
| 226 | } |
| 227 | for _, tc := range tcs { |
| 228 | t.Run(tc.name, func(t *testing.T) { |
| 229 | assert.Equalf(t, tc.want, ContainsPrefixed(tc.prefixes, tc.v), "ContainsPrefixed(%v, %v)", tc.prefixes, tc.v) |
| 230 | }) |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | func TestMapToSlice(t *testing.T) { |
| 235 | t.Run("mapStringString", func(t *testing.T) { |
nothing calls this directly
no test coverage detected