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

Function TestServerHandlerInit

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

Source from the content-addressed store, hash-verified

42}
43
44func TestServerHandlerInit(t *testing.T) {
45 cases := []struct {
46 Name string
47 DSL func()
48 }{
49 {"unary-rpcs", testdata.UnaryRPCsDSL},
50 {"unary-rpc-no-payload", testdata.UnaryRPCNoPayloadDSL},
51 {"unary-rpc-no-result", testdata.UnaryRPCNoResultDSL},
52 {"server-streaming-rpc", testdata.ServerStreamingRPCDSL},
53 {"client-streaming-rpc", testdata.ClientStreamingRPCDSL},
54 {"client-streaming-rpc-with-payload", testdata.ClientStreamingRPCWithPayloadDSL},
55 {"bidirectional-streaming-rpc", testdata.BidirectionalStreamingRPCDSL},
56 {"bidirectional-streaming-rpc-with-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL},
57 }
58 for _, c := range cases {
59 t.Run(c.Name, func(t *testing.T) {
60 root := RunGRPCDSL(t, c.DSL)
61 services := CreateGRPCServices(root)
62 fs := ServerFiles("", services)
63 require.Len(t, fs, 2)
64 sections := fs[0].Section("grpc-handler-init")
65 require.NotEmpty(t, sections)
66 code := codegen.SectionsCode(t, sections)
67 testutil.AssertGo(t, "testdata/golden/server_handler_init_"+c.Name+".go.golden", code)
68 })
69 }
70}
71
72func TestRequestDecoder(t *testing.T) {
73 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