diff --git a/ipe/connection_test.go b/ipe/connection_test.go index bec49cb..f18ce7f 100644 --- a/ipe/connection_test.go +++ b/ipe/connection_test.go @@ -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) + } +}