(t *testing.T)
| 695 | } |
| 696 | |
| 697 | func 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 | |
| 725 | func TestWebsocketMessage_Usage(t *testing.T) { |
| 726 | t.Run("type", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…