Added Test for newConnection.
This commit is contained in:
+26
-1
@@ -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
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package ipe
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user