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

Function TestServerMount

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

Source from the content-addressed store, hash-verified

13)
14
15func TestServerMount(t *testing.T) {
16 const genpkg = "gen"
17 cases := []struct {
18 Name string
19 DSL func()
20 SectionNum int
21
22 SectionName string
23 }{
24 {"simple routing constructor", testdata.ServerSimpleRoutingDSL, 0, "server-mount"},
25 {"simple routing with a redirect constructor", testdata.ServerSimpleRoutingWithRedirectDSL, 0, "server-mount"},
26 {"multiple_files_constructor", testdata.ServerMultipleFilesDSL, 0, "server-mount"},
27 {"multiple_files_mounter", testdata.ServerMultipleFilesDSL, 3, "server-files"},
28 {"multiple_files_constructor_w_prefix_path", testdata.ServerMultipleFilesWithPrefixPathDSL, 0, "server-mount"},
29 {"multiple_files_mounter_w_prefix_path", testdata.ServerMultipleFilesWithPrefixPathDSL, 3, "server-files"},
30 {"multiple_files_with_a_redirect_constructor", testdata.ServerMultipleFilesWithRedirectDSL, 0, "server-mount"},
31 {"multiple_files_with_a_redirect_mounter", testdata.ServerMultipleFilesWithRedirectDSL, 3, "server-files"},
32 }
33 for _, c := range cases {
34 t.Run(c.Name, func(t *testing.T) {
35 root := RunHTTPDSL(t, c.DSL)
36 services := CreateHTTPServices(root)
37 fs := ServerFiles(genpkg, services)
38 sections := codegentest.Sections(fs, "server.go", c.SectionName)
39 require.Greater(t, len(sections), c.SectionNum)
40 code := codegen.SectionCode(t, sections[c.SectionNum])
41 testutil.AssertGo(t, "testdata/golden/server_mount_"+c.Name+".go.golden", code)
42 })
43 }
44}

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