MCPcopy
hub / github.com/dapr/dapr / TestContainsPrefixed

Function TestContainsPrefixed

utils/utils_test.go:202–232  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func 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
234func TestMapToSlice(t *testing.T) {
235 t.Run("mapStringString", func(t *testing.T) {

Callers

nothing calls this directly

Calls 2

ContainsPrefixedFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected