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

Function TestPathTrailingShash

http/codegen/paths_test.go:48–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestPathTrailingShash(t *testing.T) {
49 cases := []struct {
50 Name string
51 DSL func()
52 }{
53 {"slash_with_base_path_no_trailing", testdata.BasePathNoTrailing_SlashWithBasePathNoTrailingDSL},
54 {"trailing_with_base_path_no_trailing", testdata.BasePathNoTrailing_TrailingWithBasePathNoTrailingDSL},
55 {"slash_with_base_path_with_trailing", testdata.BasePathWithTrailingSlash_WithBasePathWithTrailingDSL},
56 {"slash_no_base_path", testdata.NoBasePath_SlashNoBasePathDSL},
57 {"path-trailing_no_base_path", testdata.NoBasePath_TrailingNoBasePathDSL},
58 {"add-trailing-slash-to-base-path", testdata.BasePath_SpecialTrailingSlashDSL},
59 }
60
61 for _, c := range cases {
62 t.Run(c.Name, func(t *testing.T) {
63 root := RunHTTPDSL(t, c.DSL)
64 require.Len(t, root.API.HTTP.Services, 1)
65 services := CreateHTTPServices(root)
66 fs := serverPath(root.API.HTTP.Services[0], services)
67 sections := fs.SectionTemplates
68 code := codegen.SectionCode(t, sections[1])
69 testutil.AssertGo(t, "testdata/golden/paths_"+c.Name+".go.golden", code)
70 })
71 }
72}

Callers

nothing calls this directly

Calls 6

SectionCodeFunction · 0.92
AssertGoFunction · 0.92
RunHTTPDSLFunction · 0.85
CreateHTTPServicesFunction · 0.85
serverPathFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected