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

Function TestClientEndpointInit

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

Source from the content-addressed store, hash-verified

11)
12
13func TestClientEndpointInit(t *testing.T) {
14 cases := []struct {
15 Name string
16 DSL func()
17 }{
18 {"unary-rpcs", testdata.UnaryRPCsDSL},
19 {"unary-rpc-no-payload", testdata.UnaryRPCNoPayloadDSL},
20 {"unary-rpc-no-result", testdata.UnaryRPCNoResultDSL},
21 {"unary-rpc-with-errors", testdata.UnaryRPCWithErrorsDSL},
22 {"unary-rpc-acronym", testdata.UnaryRPCAcronymDSL},
23 {"server-streaming-rpc", testdata.ServerStreamingRPCDSL},
24 {"client-streaming-rpc", testdata.ClientStreamingRPCDSL},
25 {"client-streaming-rpc-no-result", testdata.ClientStreamingNoResultDSL},
26 {"client-streaming-rpc-with-payload", testdata.ClientStreamingRPCWithPayloadDSL},
27 {"bidirectional-streaming-rpc", testdata.BidirectionalStreamingRPCDSL},
28 {"bidirectional-streaming-rpc-with-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL},
29 {"bidirectional-streaming-rpc-with-errors", testdata.BidirectionalStreamingRPCWithErrorsDSL},
30 }
31 for _, c := range cases {
32 t.Run(c.Name, func(t *testing.T) {
33 root := RunGRPCDSL(t, c.DSL)
34 services := CreateGRPCServices(root)
35 fs := ClientFiles("", services)
36 require.Len(t, fs, 2)
37 sections := fs[0].Section("client-endpoint-init")
38 if len(sections) == 0 {
39 t.Fatalf("got zero sections, expected at least one")
40 }
41 code := codegen.SectionsCode(t, sections)
42 testutil.AssertGo(t, "testdata/golden/client_endpoint_init_"+c.Name+".go.golden", code)
43 })
44 }
45}
46
47func TestRequestEncoder(t *testing.T) {
48 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