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

Function TestHandlerInit

http/codegen/handler_test.go:15–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestHandlerInit(t *testing.T) {
16 const genpkg = "gen"
17 cases := []struct {
18 Name string
19 DSL func()
20 }{
21 {"no payload no result", testdata.ServerNoPayloadNoResultDSL},
22 {"no payload no result with a redirect", testdata.ServerNoPayloadNoResultWithRedirectDSL},
23 {"payload no result", testdata.ServerPayloadNoResultDSL},
24 {"payload no result with a redirect", testdata.ServerPayloadNoResultWithRedirectDSL},
25 {"no payload result", testdata.ServerNoPayloadResultDSL},
26 {"payload result", testdata.ServerPayloadResultDSL},
27 {"payload result error", testdata.ServerPayloadResultErrorDSL},
28 {"skip response body encode decode", testdata.ServerSkipResponseBodyEncodeDecodeDSL},
29 }
30 for _, c := range cases {
31 t.Run(c.Name, func(t *testing.T) {
32 root := RunHTTPDSL(t, c.DSL)
33 services := CreateHTTPServices(root)
34 fs := ServerFiles(genpkg, services)
35 sections := codegentest.Sections(fs, "server.go", "server-handler-init")
36 require.Greater(t, len(sections), 0)
37 code := codegen.SectionCode(t, sections[0])
38 testutil.AssertGo(t, "testdata/golden/handler_"+c.Name+".go.golden", code)
39 })
40 }
41}

Callers

nothing calls this directly

Calls 7

SectionsFunction · 0.92
SectionCodeFunction · 0.92
AssertGoFunction · 0.92
RunHTTPDSLFunction · 0.85
CreateHTTPServicesFunction · 0.85
ServerFilesFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected