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

Function TestServerHandler

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

Source from the content-addressed store, hash-verified

13)
14
15func TestServerHandler(t *testing.T) {
16 const genpkg = "gen"
17 cases := []struct {
18 Name string
19 DSL func()
20 }{
21 {"server simple routing", testdata.ServerSimpleRoutingDSL},
22 {"server trailing slash routing", testdata.ServerTrailingSlashRoutingDSL},
23 {"server simple routing with a redirect", testdata.ServerSimpleRoutingWithRedirectDSL},
24 }
25 for _, c := range cases {
26 t.Run(c.Name, func(t *testing.T) {
27 root := RunHTTPDSL(t, c.DSL)
28 services := CreateHTTPServices(root)
29 fs := ServerFiles(genpkg, services)
30 sections := codegentest.Sections(fs, "server.go", "server-handler")
31 require.Greater(t, len(sections), 0)
32 code := codegen.SectionCode(t, sections[0])
33 testutil.AssertGo(t, "testdata/golden/server_handler_"+c.Name+".go.golden", code)
34 })
35 }
36}

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