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

Function TestResponseEncoder

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

Source from the content-addressed store, hash-verified

99}
100
101func TestResponseEncoder(t *testing.T) {
102 cases := []struct {
103 Name string
104 DSL func()
105 }{
106 {"response-encoder-empty-result", testdata.UnaryRPCNoResultDSL},
107 {"response-encoder-result-with-views", testdata.MessageResultTypeWithViewsDSL},
108 {"response-encoder-result-with-explicit-view", testdata.MessageResultTypeWithExplicitViewDSL},
109 {"response-encoder-result-array", testdata.MessageArrayDSL},
110 {"response-encoder-result-primitive", testdata.UnaryRPCNoPayloadDSL},
111 {"response-encoder-result-with-metadata", testdata.MessageWithMetadataDSL},
112 {"response-encoder-result-with-validate", testdata.MessageWithValidateDSL},
113 {"response-encoder-result-collection", testdata.MessageResultTypeCollectionDSL},
114 }
115 for _, c := range cases {
116 t.Run(c.Name, func(t *testing.T) {
117 root := RunGRPCDSL(t, c.DSL)
118 services := CreateGRPCServices(root)
119 fs := ServerFiles("", services)
120 require.Len(t, fs, 2)
121 sections := fs[1].Section("response-encoder")
122 require.NotEmpty(t, sections)
123 code := codegen.SectionsCode(t, sections)
124 testutil.AssertGo(t, "testdata/golden/response_encoder_"+c.Name+".go.golden", code)
125 })
126 }
127}

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