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

Function TestWsHandlerJSON

_examples/websocket_test.go:36–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestWsHandlerJSON(t *testing.T) {
37 e := wsHandlerTester(t)
38
39 ws := e.GET("/path").WithWebsocketUpgrade().
40 Expect().
41 Status(http.StatusSwitchingProtocols).
42 Websocket()
43 defer ws.Disconnect()
44
45 ws.WriteJSON(struct {
46 Message string `json:"message"`
47 }{"hi"}).
48 Expect().
49 TextMessage().JSON().Object().HasValue("message", "hi")
50}
51
52func TestWsHandlerClose(t *testing.T) {
53 e := wsHandlerTester(t)

Callers

nothing calls this directly

Calls 12

wsHandlerTesterFunction · 0.85
WebsocketMethod · 0.80
StatusMethod · 0.80
WithWebsocketUpgradeMethod · 0.80
GETMethod · 0.80
DisconnectMethod · 0.80
TextMessageMethod · 0.80
WriteJSONMethod · 0.80
ExpectMethod · 0.45
HasValueMethod · 0.45
ObjectMethod · 0.45
JSONMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…