Added Test for newConnection.

This commit is contained in:
claudemiro
2016-01-17 00:27:21 -02:00
parent cbb34a928f
commit 59abf6ac5b
+26 -1
View File
@@ -1,5 +1,30 @@
// Copyright 2014 Claudemiro Alves Feitosa Neto. All rights reserved.
// Copyright 2016 Claudemiro Alves Feitosa Neto. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package ipe
import (
"testing"
"github.com/gorilla/websocket"
)
func TestNewConnection(t *testing.T) {
expectedSocketID := "socketID"
expectedSocket := &websocket.Conn{}
c := newConnection(expectedSocketID, expectedSocket)
if c.SocketID != expectedSocketID {
t.Errorf("Expected: %s but got %s", expectedSocketID, c.SocketID)
}
if c.Socket != expectedSocket {
t.Errorf("Expected: %+v but got %+v", expectedSocket, c.Socket)
}
if c.CreatedAt.IsZero() {
t.Errorf("Expected %s to not be zero", c.CreatedAt)
}
}