-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_test.go
37 lines (29 loc) · 671 Bytes
/
client_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
37
package Agora
import (
"bufio"
"bytes"
"testing"
)
func TestNewClient_ReturnsValidClient(t *testing.T) {
testName := "TestClient"
buf := new(bytes.Buffer)
bufWriter := bufio.NewWriter(buf)
bufReader := bufio.NewReader(buf)
underTest := NewClient(testName, bufWriter, bufReader)
if underTest.Closed == nil {
t.Error("Closed channel nil")
t.Fail()
}
if underTest.Name != testName {
t.Errorf("Expected name to be %s, received %s", testName, underTest.Name)
t.Fail()
}
if underTest.Writer != bufWriter {
t.Error("Writer not set correctly")
t.Fail()
}
if underTest.Reader != bufReader {
t.Error("Reader not set correctly")
t.Fail()
}
}