MCPcopy Create free account
hub / github.com/goadesign/goa / TestMethodExprValidateInterceptors

Function TestMethodExprValidateInterceptors

expr/method_test.go:257–283  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

255}
256
257func TestMethodExprValidateInterceptors(t *testing.T) {
258 cases := []struct {
259 Name string
260 DSL func()
261 Error string
262 }{
263 {"no-interceptors", testdata.NoInterceptorsDSL, ""},
264 {"valid-interceptors", testdata.ValidInterceptorsDSL, ""},
265 {"duplicate-interceptors", testdata.DuplicateInterceptorsDSL, ""}, // Duplicates are handled by merging
266 {"mixed-interceptors", testdata.MixedInterceptorsDSL, ""},
267 {"undefined-interceptor", testdata.UndefinedInterceptorDSL,
268 `ServerInterceptor: interceptor "undefined" not found in service "Service" method "Method"`},
269 {"empty-interceptor-name", testdata.EmptyInterceptorNameDSL,
270 `ServerInterceptor: interceptor name cannot be empty`},
271 }
272
273 for _, c := range cases {
274 t.Run(c.Name, func(t *testing.T) {
275 if c.Error == "" {
276 expr.RunDSL(t, c.DSL)
277 return
278 }
279 err := expr.RunInvalidDSL(t, c.DSL)
280 assert.Contains(t, err.Error(), c.Error)
281 })
282 }
283}

Callers

nothing calls this directly

Calls 4

RunDSLFunction · 0.92
RunInvalidDSLFunction · 0.92
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected