MCPcopy Create free account
hub / github.com/gavv/httpexpect / TestWebsocket_CloseWithJSON

Function TestWebsocket_CloseWithJSON

websocket_test.go:421–509  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

419}
420
421func TestWebsocket_CloseWithJSON(t *testing.T) {
422 type args struct {
423 wsConn WebsocketConn
424 wsPreSteps func(*Websocket)
425 content interface{}
426 closeCode []int
427 }
428 cases := []struct {
429 name string
430 args args
431 result chainResult
432 }{
433 {
434 name: "success",
435 args: args{
436 wsPreSteps: noWsPreSteps,
437 wsConn: &mockWebsocketConn{},
438 content: map[string]string{
439 "msg": "connection closing...",
440 },
441 closeCode: []int{websocket.CloseNormalClosure},
442 },
443 result: success,
444 },
445 {
446 name: "conn is nil",
447 args: args{
448 wsPreSteps: noWsPreSteps,
449 wsConn: nil,
450 content: map[string]string{
451 "msg": "connection closing...",
452 },
453 closeCode: []int{websocket.CloseNormalClosure},
454 },
455 result: failure,
456 },
457 {
458 name: "websocket unusable",
459 args: args{
460 wsPreSteps: func(ws *Websocket) {
461 ws.Disconnect()
462 },
463 wsConn: &mockWebsocketConn{},
464 content: map[string]string{
465 "msg": "connection closing...",
466 },
467 closeCode: []int{websocket.CloseNormalClosure},
468 },
469 result: failure,
470 },
471 {
472 name: "too many close codes",
473 args: args{
474 wsPreSteps: noWsPreSteps,
475 wsConn: &mockWebsocketConn{},
476 content: map[string]string{
477 "msg": "connection closing...",
478 },

Callers

nothing calls this directly

Calls 7

newMockReporterFunction · 0.85
newChainWithDefaultsFunction · 0.85
newMockConfigFunction · 0.85
newWebsocketFunction · 0.85
DisconnectMethod · 0.80
CloseWithJSONMethod · 0.80
assertMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…