MCPcopy
hub / github.com/olahol/melody / TestUpgrader

Function TestUpgrader

melody_test.go:169–187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestUpgrader(t *testing.T) {
170 ws := NewTestServer()
171 ws.m.HandleMessage(func(session *Session, msg []byte) {
172 session.Write(msg)
173 })
174
175 server := httptest.NewServer(ws)
176 defer server.Close()
177
178 ws.m.Upgrader = &websocket.Upgrader{
179 ReadBufferSize: 1024,
180 WriteBufferSize: 1024,
181 CheckOrigin: func(r *http.Request) bool { return false },
182 }
183
184 _, err := NewDialer(server.URL)
185
186 assert.ErrorIs(t, err, websocket.ErrBadHandshake)
187}
188
189func TestBroadcast(t *testing.T) {
190 n := 10

Callers

nothing calls this directly

Calls 5

NewTestServerFunction · 0.85
NewDialerFunction · 0.85
HandleMessageMethod · 0.80
WriteMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…