MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestWebsocketMessage_JSON

Function TestWebsocketMessage_JSON

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

Source from the content-addressed store, hash-verified

695}
696
697func TestWebsocketMessage_JSON(t *testing.T) {
698 t.Run("good", func(t *testing.T) {
699 reporter := newMockReporter(t)
700
701 body := []byte(`{"foo":"bar"}`)
702
703 msg := NewWebsocketMessage(reporter, websocket.TextMessage, body)
704
705 j := msg.JSON()
706 j.chain.assert(t, success)
707
708 require.Equal(t, "bar", j.Object().Value("foo").Raw())
709 })
710
711 t.Run("bad", func(t *testing.T) {
712 reporter := newMockReporter(t)
713
714 body := []byte(`{`)
715
716 msg := NewWebsocketMessage(reporter, websocket.TextMessage, body)
717
718 j := msg.JSON()
719 j.chain.assert(t, failure)
720
721 msg.chain.assert(t, failure)
722 })
723}
724
725func TestWebsocketMessage_Usage(t *testing.T) {
726 t.Run("type", func(t *testing.T) {

Callers

nothing calls this directly

Calls 8

JSONMethod · 0.95
newMockReporterFunction · 0.85
NewWebsocketMessageFunction · 0.85
assertMethod · 0.80
EqualMethod · 0.45
RawMethod · 0.45
ValueMethod · 0.45
ObjectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…