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

Function TestWebsocketMessage_BinaryMessage

websocket_message_test.go:390–483  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

388}
389
390func TestWebsocketMessage_BinaryMessage(t *testing.T) {
391 t.Run("BinaryMessage type with functions", func(t *testing.T) {
392 cases := []struct {
393 name string
394 typ int
395 fn func(s *WebsocketMessage) *WebsocketMessage
396 want chainResult
397 }{
398 {
399 name: "BinaryMessage type with CloseMessage function",
400 typ: websocket.BinaryMessage,
401 fn: (*WebsocketMessage).CloseMessage,
402 want: failure,
403 },
404 {
405 name: "BinaryMessage type with NotCloseMessage function",
406 typ: websocket.BinaryMessage,
407 fn: (*WebsocketMessage).NotCloseMessage,
408 want: success,
409 },
410 {
411 name: "BinaryMessage type with BinaryMessage function",
412 typ: websocket.BinaryMessage,
413 fn: (*WebsocketMessage).BinaryMessage,
414 want: success,
415 },
416 {
417 name: "BinaryMessage type with NotBinaryMessage function",
418 typ: websocket.BinaryMessage,
419 fn: (*WebsocketMessage).NotBinaryMessage,
420 want: failure,
421 },
422 {
423 name: "BinaryMessage type with TextMessage function",
424 typ: websocket.BinaryMessage,
425 fn: (*WebsocketMessage).TextMessage,
426 want: failure,
427 },
428 {
429 name: "BinaryMessage type with NotTextMessage function",
430 typ: websocket.BinaryMessage,
431 fn: (*WebsocketMessage).NotTextMessage,
432 want: success,
433 },
434 }
435
436 for _, tc := range cases {
437 t.Run(tc.name, func(t *testing.T) {
438 reporter := newMockReporter(t)
439
440 tc.fn(NewWebsocketMessage(reporter, tc.typ, nil, 1000)).
441 chain.assert(t, tc.want)
442 })
443 }
444 })
445
446 t.Run("BinaryMessage with types ", func(t *testing.T) {
447 cases := []struct {

Callers

nothing calls this directly

Calls 5

newMockReporterFunction · 0.85
NewWebsocketMessageFunction · 0.85
assertMethod · 0.80
TypeMethod · 0.80
NotTypeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…