forked from umirode/echo-socket.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wrapper_test.go
63 lines (46 loc) · 1.47 KB
/
wrapper_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package echo_socket_io_test
import (
"testing"
socketio "github.com/googollee/go-socket.io"
"github.com/stretchr/testify/assert"
"github.com/webx-top/echo"
echo_socket_io "github.com/webx-top/echo-socket.io"
)
func TestNewWrapper(t *testing.T) {
wrapper := echo_socket_io.NewWrapper(nil)
assert.NotNil(t, wrapper)
assert.Implements(t, (*echo_socket_io.IWrapper)(nil), wrapper)
}
func TestNewWrapperWithServer(t *testing.T) {
socketioServer := socketio.NewServer(nil)
assert.NotNil(t, socketioServer)
wrapper, err := echo_socket_io.NewWrapperWithServer(socketioServer)
assert.NotNil(t, wrapper)
assert.Nil(t, err)
assert.Implements(t, (*echo_socket_io.IWrapper)(nil), wrapper)
}
func TestWrapper_OnConnect(t *testing.T) {
wrapper := echo_socket_io.NewWrapper(nil)
assert.NotNil(t, wrapper)
wrapper.OnConnect("", func(context echo.Context, conn socketio.Conn) error {
return nil
})
}
func TestWrapper_OnDisconnect(t *testing.T) {
wrapper := echo_socket_io.NewWrapper(nil)
assert.NotNil(t, wrapper)
wrapper.OnDisconnect("", func(context echo.Context, conn socketio.Conn, s string) {
})
}
func TestWrapper_OnError(t *testing.T) {
wrapper := echo_socket_io.NewWrapper(nil)
assert.NotNil(t, wrapper)
wrapper.OnError("", func(context echo.Context, conn socketio.Conn, e error) {
})
}
func TestWrapper_OnEvent(t *testing.T) {
wrapper := echo_socket_io.NewWrapper(nil)
assert.NotNil(t, wrapper)
wrapper.OnEvent("", "", func(echo.Context, socketio.Conn, string) {
})
}