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

Function TestWebsocket_SetWriteDeadline

websocket_test.go:958–1000  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

956}
957
958func TestWebsocket_SetWriteDeadline(t *testing.T) {
959 type args struct {
960 wsConn WebsocketConn
961 }
962 cases := []struct {
963 name string
964 args args
965 result chainResult
966 }{
967 {
968 name: "success",
969 args: args{
970 wsConn: &mockWebsocketConn{},
971 },
972 result: success,
973 },
974 {
975 name: "conn.SetReadDeadline error",
976 args: args{
977 wsConn: &mockWebsocketConn{
978 writeDlError: errors.New("Failed to set read deadline"),
979 },
980 },
981 result: failure,
982 },
983 }
984 for _, tc := range cases {
985 t.Run(tc.name, func(t *testing.T) {
986 reporter := newMockReporter(t)
987 chain := newChainWithDefaults("test", reporter)
988 config := newMockConfig(reporter)
989
990 ws := newWebsocket(chain, config, tc.args.wsConn).
991 WithWriteTimeout(time.Second)
992
993 opChain := ws.chain.enter("test")
994 ws.setWriteDeadline(opChain)
995 opChain.leave()
996
997 ws.chain.assert(t, tc.result)
998 })
999 }
1000}
1001
1002func TestWebsocket_Disconnect(t *testing.T) {
1003 type args struct {

Callers

nothing calls this directly

Calls 9

newMockReporterFunction · 0.85
newChainWithDefaultsFunction · 0.85
newMockConfigFunction · 0.85
newWebsocketFunction · 0.85
WithWriteTimeoutMethod · 0.80
enterMethod · 0.80
setWriteDeadlineMethod · 0.80
leaveMethod · 0.80
assertMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…