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

Function TestWebsocketMessage_CloseMessage

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

Source from the content-addressed store, hash-verified

157}
158
159func TestWebsocketMessage_CloseMessage(t *testing.T) {
160 t.Run("CloseMessage type with functions", func(t *testing.T) {
161 cases := []struct {
162 name string
163 typ int
164 fn func(s *WebsocketMessage) *WebsocketMessage
165 want chainResult
166 }{
167 {
168 name: "CloseMessage type with CloseMessage function",
169 typ: websocket.CloseMessage,
170 fn: (*WebsocketMessage).CloseMessage,
171 want: success,
172 },
173 {
174 name: "CloseMessage type with NotCloseMessage function",
175 typ: websocket.CloseMessage,
176 fn: (*WebsocketMessage).NotCloseMessage,
177 want: failure,
178 },
179 {
180 name: "CloseMessage type with BinaryMessage function",
181 typ: websocket.CloseMessage,
182 fn: (*WebsocketMessage).BinaryMessage,
183 want: failure,
184 },
185 {
186 name: "CloseMessage type with NotBinaryMessage function",
187 typ: websocket.CloseMessage,
188 fn: (*WebsocketMessage).NotBinaryMessage,
189 want: success,
190 },
191 {
192 name: "CloseMessage type with TextMessage function",
193 typ: websocket.CloseMessage,
194 fn: (*WebsocketMessage).TextMessage,
195 want: failure,
196 },
197 {
198 name: "CloseMessage type with NotTextMessage function",
199 typ: websocket.CloseMessage,
200 fn: (*WebsocketMessage).NotTextMessage,
201 want: success,
202 },
203 }
204
205 for _, tc := range cases {
206 t.Run(tc.name, func(t *testing.T) {
207 reporter := newMockReporter(t)
208
209 tc.fn(NewWebsocketMessage(reporter, tc.typ, nil, 1000)).
210 chain.assert(t, tc.want)
211 })
212 }
213 })
214
215 t.Run("CloseMessage type with codes", func(t *testing.T) {
216 cases := []struct {

Callers

nothing calls this directly

Calls 5

newMockReporterFunction · 0.85
NewWebsocketMessageFunction · 0.85
assertMethod · 0.80
CodeMethod · 0.80
NotCodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…