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

Function TestClientDecode

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

Source from the content-addressed store, hash-verified

11)
12
13func TestClientDecode(t *testing.T) {
14 cases := []struct {
15 Name string
16 DSL func()
17 }{
18 {"empty-body", testdata.EmptyServerResponseDSL},
19 {"body-result-multiple-views", testdata.ResultBodyMultipleViewsDSL},
20 {"empty-body-result-multiple-views", testdata.EmptyBodyResultMultipleViewsDSL},
21 {"explicit-body-primitive-result", testdata.ExplicitBodyPrimitiveResultMultipleViewsDSL},
22 {"explicit-body-result-multiple-views", testdata.ExplicitBodyUserResultMultipleViewsDSL},
23 {"explicit-body-result-collection", testdata.ExplicitBodyResultCollectionDSL},
24 {"tag-result-multiple-views", testdata.ResultMultipleViewsTagDSL},
25 {"empty-server-response-with-tags", testdata.EmptyServerResponseWithTagsDSL},
26 {"header-string-implicit", testdata.ResultHeaderStringImplicitDSL},
27 {"header-string-array", testdata.ResultHeaderStringArrayDSL},
28 {"header-string-array-validate", testdata.ResultHeaderStringArrayValidateDSL},
29 {"header-array", testdata.ResultHeaderArrayDSL},
30 {"header-array-validate", testdata.ResultHeaderArrayValidateDSL},
31 {"with-headers-dsl", testdata.WithHeadersBlockDSL},
32 {"with-headers-dsl-viewed-result", testdata.WithHeadersBlockViewedResultDSL},
33 {"validate-error-response-type", testdata.ValidateErrorResponseTypeDSL},
34 {"empty-error-response-body", testdata.EmptyErrorResponseBodyDSL},
35 }
36 for _, c := range cases {
37 t.Run(c.Name, func(t *testing.T) {
38 root := RunHTTPDSL(t, c.DSL)
39 services := CreateHTTPServices(root)
40 fs := ClientFiles("", services)
41 require.Len(t, fs, 2)
42 sections := fs[1].SectionTemplates
43 require.Greater(t, len(sections), 2)
44 code := codegen.SectionCode(t, sections[2])
45 testutil.AssertGo(t, "testdata/golden/client_decode_"+c.Name+".go.golden", code)
46 })
47 }
48}

Callers

nothing calls this directly

Calls 6

SectionCodeFunction · 0.92
AssertGoFunction · 0.92
RunHTTPDSLFunction · 0.85
CreateHTTPServicesFunction · 0.85
ClientFilesFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected