39 lines
706 B
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)
|
|
})
|
|
})
|
|
}
|