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

Function TestWebsocketMessage_TextMessage

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

Source from the content-addressed store, hash-verified

294}
295
296func TestWebsocketMessage_TextMessage(t *testing.T) {
297 t.Run("TextMessage type with functions", func(t *testing.T) {
298 cases := []struct {
299 name string
300 typ int
301 fn func(s *WebsocketMessage) *WebsocketMessage
302 want chainResult
303 }{
304 {
305 name: "TextMessage type with CloseMessage function",
306 typ: websocket.TextMessage,
307 fn: (*WebsocketMessage).CloseMessage,
308 want: failure,
309 },
310 {
311 name: "TextMessage type with NotCloseMessage function",
312 typ: websocket.TextMessage,
313 fn: (*WebsocketMessage).NotCloseMessage,
314 want: success,
315 },
316 {
317 name: "TextMessage type with BinaryMessage function",
318 typ: websocket.TextMessage,
319 fn: (*WebsocketMessage).BinaryMessage,
320 want: failure,
321 },
322 {
323 name: "TextMessage type with NotBinaryMessage function",
324 typ: websocket.TextMessage,
325 fn: (*WebsocketMessage).NotBinaryMessage,
326 want: success,
327 },
328 {
329 name: "TextMessage type with TextMessage function",
330 typ: websocket.TextMessage,
331 fn: (*WebsocketMessage).TextMessage,
332 want: success,
333 },
334 {
335 name: "TextMessage type with NotTextMessage function",
336 typ: websocket.TextMessage,
337 fn: (*WebsocketMessage).NotTextMessage,
338 want: failure,
339 },
340 }
341
342 for _, tc := range cases {
343 t.Run(tc.name, func(t *testing.T) {
344 reporter := newMockReporter(t)
345
346 tc.fn(NewWebsocketMessage(reporter, tc.typ, nil, 1000)).
347 chain.assert(t, tc.want)
348 })
349 }
350 })
351
352 t.Run("TextMessage type with types", func(t *testing.T) {
353 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…