From e67ee92244ccd8aa1b312a2b9de7e6e007aa64e0 Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Thu, 14 Mar 2019 15:34:49 -0700 Subject: [PATCH] add tests for both client and server --- api/proto/message/client_test.go | 18 ++++++++++++++++++ api/proto/message/server_test.go | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 api/proto/message/client_test.go create mode 100644 api/proto/message/server_test.go diff --git a/api/proto/message/client_test.go b/api/proto/message/client_test.go new file mode 100644 index 000000000..58917b20d --- /dev/null +++ b/api/proto/message/client_test.go @@ -0,0 +1,18 @@ +package message + +import ( + "testing" +) + +const ( + testIP = "127.0.0.1" +) + +func TestClient(t *testing.T) { + s := NewServer() + s.Start(testIP, "") + + client := NewClient(testIP) + client.Process(&Message{}) + s.Stop() +} diff --git a/api/proto/message/server_test.go b/api/proto/message/server_test.go new file mode 100644 index 000000000..db750b422 --- /dev/null +++ b/api/proto/message/server_test.go @@ -0,0 +1,13 @@ +package message + +import ( + "testing" + "time" +) + +func TestServerStart(t *testing.T) { + s := NewServer() + s.Start("127.0.0.1", "") + time.Sleep(time.Second) + s.Stop() +}