Documentation ¶
Overview ¶
Package jsonwstesting defines helpers to test web sockets.
Index ¶
- type MockClose
- type MockConn
- func (a *MockConn) Close() error
- func (a *MockConn) Ping() error
- func (a *MockConn) ReadJSON(msg interface{}) error
- func (a *MockConn) SetPongHandler(h func(string) error)
- func (a *MockConn) SetReadDeadline(t time.Time) error
- func (a *MockConn) SetReadLimit(limit int64)
- func (a *MockConn) SetWriteDeadline(t time.Time) error
- func (a *MockConn) WriteJSON(msg interface{}) error
- type MockPing
- type MockReadJSON
- type MockSetPongHandler
- type MockSetReadDeadline
- type MockSetReadLimit
- type MockSetWriteDeadline
- type MockWriteJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockClose ¶
type MockClose struct { // The number of times the function was called. CalledCount int // An optional implementation of the function. Fn func() error }
MockClose mocks the Close function.
type MockConn ¶
type MockConn struct { // The mock for the Close function. MockClose MockClose // The mock for the WriteJSON function. MockWriteJSON MockWriteJSON // The mock for the ReadJSON function. MockReadJSON MockReadJSON // The mock for the SetReadLimit function. MockSetReadLimit MockSetReadLimit // The mock for the SetReadDeadline function. MockSetReadDeadline MockSetReadDeadline // The mock for the SetWriteDeadline function. MockSetWriteDeadline MockSetWriteDeadline // The mock for the SetPongHandler function. MockSetPongHandler MockSetPongHandler // The mock for the Ping function. MockPing MockPing }
MockConn is used to mock a connection.
It implements github.com/stratumn/go-core/jsonws.Conn and github.com/stratumn/go-core/jsonws.PingableConn.
func (*MockConn) SetPongHandler ¶
SetPongHandler implements github.com/stratumn/go-core/jsonws.Conn.SetPongHandler.
func (*MockConn) SetReadDeadline ¶
SetReadDeadline implements github.com/stratumn/go-core/jsonws.Conn.SetReadDeadline.
func (*MockConn) SetReadLimit ¶
SetReadLimit implements github.com/stratumn/go-core/jsonws.Conn.SetReadLimit.
func (*MockConn) SetWriteDeadline ¶
SetWriteDeadline implements github.com/stratumn/go-core/jsonws.Conn.SetWriteDeadline.
type MockPing ¶
type MockPing struct { // The number of times the function was called. CalledCount int // An optional implementation of the function. Fn func() error }
MockPing mocks the SetPing function.
type MockReadJSON ¶
type MockReadJSON struct { // The number of times the function was called. CalledCount int // The channel that was passed to each call. CalledWith []interface{} // The last channel that was passed. LastCalledWith interface{} // An optional implementation of the function. Fn func(interface{}) error }
MockReadJSON mocks the ReadJSON function.
type MockSetPongHandler ¶
type MockSetPongHandler struct { // The number of times the function was called. CalledCount int // The channel that was passed to each call. CalledWith []func(string) error // The last channel that was passed. LastCalledWith func(string) error // An optional implementation of the function. Fn func(func(string) error) }
MockSetPongHandler mocks the SetPongHandler function.
type MockSetReadDeadline ¶
type MockSetReadDeadline struct { // The number of times the function was called. CalledCount int // The channel that was passed to each call. CalledWith []time.Time // The last channel that was passed. LastCalledWith time.Time // An optional implementation of the function. Fn func(time.Time) error }
MockSetReadDeadline mocks the SetReadDeadline function.
type MockSetReadLimit ¶
type MockSetReadLimit struct { // The number of times the function was called. CalledCount int // The channel that was passed to each call. CalledWith []int64 // The last channel that was passed. LastCalledWith int64 // An optional implementation of the function. Fn func(int64) }
MockSetReadLimit mocks the SetReadLimit function.
type MockSetWriteDeadline ¶
type MockSetWriteDeadline struct { // The number of times the function was called. CalledCount int // The channel that was passed to each call. CalledWith []time.Time // The last channel that was passed. LastCalledWith time.Time // An optional implementation of the function. Fn func(time.Time) error }
MockSetWriteDeadline mocks the SetWriteDeadline function.
type MockWriteJSON ¶
type MockWriteJSON struct { // The number of times the function was called. CalledCount int // The channel that was passed to each call. CalledWith []interface{} // The last channel that was passed. LastCalledWith interface{} // An optional implementation of the function. Fn func(interface{}) error }
MockWriteJSON mocks the WriteJSON function.