micro-client-drpc/request_test.go
Vasiliy Tolstov 9d59e4cdb4 add needed files
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-12 23:26:22 +03:00

42 lines
650 B
Go

package drpc
import (
"testing"
)
func TestMethodToDRPC(t *testing.T) {
testData := []struct {
service string
method string
expect string
}{
{
"helloworld",
"Greeter.SayHello",
"/Helloworld.Greeter/SayHello",
},
{
"helloworld",
"/Helloworld.Greeter/SayHello",
"/Helloworld.Greeter/SayHello",
},
{
"",
"/Helloworld.Greeter/SayHello",
"/Helloworld.Greeter/SayHello",
},
{
"",
"Greeter.SayHello",
"/Greeter/SayHello",
},
}
for _, d := range testData {
method := methodToDRPC(d.service, d.method)
if method != d.expect {
t.Fatalf("expected %s got %s", d.expect, method)
}
}
}