tu-wien
/
kerma
Archived
2
0
Fork 0
This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
kerma/utils/tests/client_test.go

39 lines
706 B
Go

package tests
import (
"kerma/helpers"
"kerma/models"
"kerma/utils"
"net"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestClient(t *testing.T) {
host := "127.0.0.1:1338"
net.Listen("tcp", host)
conn, _ := net.Dial("tcp", host)
defer conn.Close()
var config helpers.Config
config.Construct()
var handler utils.TCPHandler
handler.Construct(conn)
var state models.State
state.Construct()
Convey("Given a new client", t, func() {
var client utils.Client
client.Construct(&state, handler)
Convey("When Construct is called, a new object is returned", func() {
So(client.State, ShouldResemble, &state)
So(client.Handler, ShouldResemble, handler)
})
})
}