This commit is contained in:
Asim Aslam
2020-07-23 23:03:27 +01:00
commit 5a96bf5ef0
5 changed files with 333 additions and 0 deletions

22
client/client_test.go Normal file
View File

@@ -0,0 +1,22 @@
package client
import "testing"
type req struct {
Name string `json:"name"`
}
type rsp struct {
Msg string `json:"msg"`
}
func TestBasicCall(t *testing.T) {
response := rsp{}
if err := NewClient(nil).Call("go.micro.srv.greeter", "Say.Hello", req{Name: "John"}, &response); err != nil {
t.Fail()
}
if response.Msg != "Hello John" {
t.Logf("Message is not as expected: %v", response.Msg)
t.Fail()
}
}