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

Function TestRequestDecoder

grpc/codegen/server_test.go:72–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestRequestDecoder(t *testing.T) {
73 cases := []struct {
74 Name string
75 DSL func()
76 }{
77 {"request-decoder-payload-user-type", testdata.MessageUserTypeWithNestedUserTypesDSL},
78 {"request-decoder-payload-array", testdata.UnaryRPCNoResultDSL},
79 {"request-decoder-payload-map", testdata.MessageMapDSL},
80 {"request-decoder-payload-primitive", testdata.ServerStreamingRPCDSL},
81 {"request-decoder-payload-primitive-with-streaming-payload", testdata.ClientStreamingRPCWithPayloadDSL},
82 {"request-decoder-payload-user-type-with-streaming-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL},
83 {"request-decoder-payload-with-metadata", testdata.MessageWithMetadataDSL},
84 {"request-decoder-payload-with-validate", testdata.MessageWithValidateDSL},
85 {"request-decoder-payload-with-security-attributes", testdata.MessageWithSecurityAttrsDSL},
86 }
87 for _, c := range cases {
88 t.Run(c.Name, func(t *testing.T) {
89 root := RunGRPCDSL(t, c.DSL)
90 services := CreateGRPCServices(root)
91 fs := ServerFiles("", services)
92 require.Len(t, fs, 2)
93 sections := fs[1].Section("request-decoder")
94 require.NotEmpty(t, sections)
95 code := codegen.SectionsCode(t, sections)
96 testutil.AssertGo(t, "testdata/golden/request_decoder_"+c.Name+".go.golden", code)
97 })
98 }
99}
100
101func TestResponseEncoder(t *testing.T) {
102 cases := []struct {

Callers

nothing calls this directly

Calls 7

SectionsCodeFunction · 0.92
AssertGoFunction · 0.92
RunGRPCDSLFunction · 0.85
CreateGRPCServicesFunction · 0.85
SectionMethod · 0.80
ServerFilesFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected