forked from grpc/grpc-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers_test.go
36 lines (31 loc) · 1.07 KB
/
helpers_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//Copyright 2017 Improbable. All Rights Reserved.
// See LICENSE for licensing terms.
package grpcweb_test
import (
"sort"
"testing"
testproto "github.com/improbable-eng/grpc-web/integration_test/go/_proto/improbable/grpcweb/test"
"github.com/improbable-eng/grpc-web/go/grpcweb"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
)
func TestListGRPCResources(t *testing.T) {
server := grpc.NewServer()
testproto.RegisterTestServiceServer(server, &testServiceImpl{})
expected := []string{
"/improbable.grpcweb.test.TestService/PingEmpty",
"/improbable.grpcweb.test.TestService/Ping",
"/improbable.grpcweb.test.TestService/PingError",
"/improbable.grpcweb.test.TestService/PingList",
"/improbable.grpcweb.test.TestService/Echo",
"/improbable.grpcweb.test.TestService/PingPongBidi",
"/improbable.grpcweb.test.TestService/PingStream",
}
actual := grpcweb.ListGRPCResources(server)
sort.Strings(expected)
sort.Strings(actual)
assert.EqualValues(t,
expected,
actual,
"list grpc resources must provide an exhaustive list of all registered handlers")
}