You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
1.9 KiB
115 lines
1.9 KiB
2 months ago
|
package socket
|
||
|
|
||
|
import (
|
||
|
"github.com/gorilla/websocket"
|
||
|
"net/http"
|
||
|
"sync"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestClient_send(t *testing.T) {
|
||
|
type fields struct {
|
||
|
Id string
|
||
|
conn *websocket.Conn
|
||
|
msg chan []byte
|
||
|
symbol sync.Map
|
||
|
mux sync.Mutex
|
||
|
token string
|
||
|
}
|
||
|
type args struct {
|
||
|
data string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
fields fields
|
||
|
args args
|
||
|
wantErr bool
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
u := &Client{
|
||
|
Id: tt.fields.Id,
|
||
|
conn: tt.fields.conn,
|
||
|
msg: tt.fields.msg,
|
||
|
symbol: tt.fields.symbol,
|
||
|
mux: tt.fields.mux,
|
||
|
token: tt.fields.token,
|
||
|
}
|
||
|
if err := u.send(tt.args.data); (err != nil) != tt.wantErr {
|
||
|
t.Errorf("send() error = %v, wantErr %v", err, tt.wantErr)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestWsHandlerOrder(t *testing.T) {
|
||
|
type args struct {
|
||
|
w http.ResponseWriter
|
||
|
r *http.Request
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
WsHandlerOrder(tt.args.w, tt.args.r)
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func Test_cleanSubscriptionKey(t *testing.T) {
|
||
|
type args struct {
|
||
|
cl *Client
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
cleanSubscriptionKey(tt.args.cl)
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func Test_readShare(t *testing.T) {
|
||
|
type args struct {
|
||
|
cl *Client
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
readShare(tt.args.cl)
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func Test_writeShare(t *testing.T) {
|
||
|
type args struct {
|
||
|
cl *Client
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
writeShare(tt.args.cl)
|
||
|
})
|
||
|
}
|
||
|
}
|