mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-14 16:17:17 +03:00
25 lines
428 B
Go
25 lines
428 B
Go
package message
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestMakeUser(t *testing.T) {
|
|
var actual, expected []byte
|
|
|
|
s := &MockScreen{}
|
|
u := NewUserScreen(SimpleId("foo"), s)
|
|
m := NewAnnounceMsg("hello")
|
|
|
|
defer u.Close()
|
|
u.Send(m)
|
|
u.HandleMsg(u.ConsumeOne())
|
|
|
|
s.Read(&actual)
|
|
expected = []byte(m.String() + Newline)
|
|
if !reflect.DeepEqual(actual, expected) {
|
|
t.Errorf("Got: `%s`; Expected: `%s`", actual, expected)
|
|
}
|
|
}
|