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

Function TestRequestEncoder

grpc/codegen/client_test.go:47–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestRequestEncoder(t *testing.T) {
48 cases := []struct {
49 Name string
50 DSL func()
51 }{
52 {"request-encoder-payload-user-type", testdata.MessageUserTypeWithNestedUserTypesDSL},
53 {"request-encoder-payload-array", testdata.UnaryRPCNoResultDSL},
54 {"request-encoder-payload-map", testdata.MessageMapDSL},
55 {"request-encoder-payload-primitive", testdata.ServerStreamingRPCDSL},
56 {"request-encoder-payload-primitive-with-streaming-payload", testdata.ClientStreamingRPCWithPayloadDSL},
57 {"request-encoder-payload-user-type-with-streaming-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL},
58 {"request-encoder-payload-with-metadata", testdata.MessageWithMetadataDSL},
59 {"request-encoder-payload-with-validate", testdata.MessageWithValidateDSL},
60 {"request-encoder-payload-with-security-attributes", testdata.MessageWithSecurityAttrsDSL},
61 }
62 for _, c := range cases {
63 t.Run(c.Name, func(t *testing.T) {
64 root := RunGRPCDSL(t, c.DSL)
65 services := CreateGRPCServices(root)
66 fs := ClientFiles("", services)
67 require.Len(t, fs, 2)
68 sections := fs[1].Section("request-encoder")
69 require.NotEmpty(t, sections)
70 code := codegen.SectionsCode(t, sections)
71 testutil.AssertGo(t, "testdata/golden/request_encoder_"+c.Name+".go.golden", code)
72 })
73 }
74}
75
76func TestResponseDecoder(t *testing.T) {
77 cases := []struct {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected