mirror of
				https://github.com/shazow/ssh-chat.git
				synced 2025-11-04 13:35:40 +01: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)
 | 
						|
	}
 | 
						|
}
 |