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

Function TestWebsocket_SetReadDeadline

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

Source from the content-addressed store, hash-verified

912}
913
914func TestWebsocket_SetReadDeadline(t *testing.T) {
915 type args struct {
916 wsConn WebsocketConn
917 }
918 cases := []struct {
919 name string
920 args args
921 result chainResult
922 }{
923 {
924 name: "success",
925 args: args{
926 wsConn: &mockWebsocketConn{},
927 },
928 result: success,
929 },
930 {
931 name: "conn.SetReadDeadline error",
932 args: args{
933 wsConn: &mockWebsocketConn{
934 readDlError: errors.New("Failed to set read deadline"),
935 },
936 },
937 result: failure,
938 },
939 }
940 for _, tc := range cases {
941 t.Run(tc.name, func(t *testing.T) {
942 reporter := newMockReporter(t)
943 chain := newChainWithDefaults("test", reporter)
944 config := newMockConfig(reporter)
945
946 ws := newWebsocket(chain, config, tc.args.wsConn).
947 WithReadTimeout(time.Second)
948
949 opChain := ws.chain.enter("test")
950 ws.setReadDeadline(opChain)
951 opChain.leave()
952
953 ws.chain.assert(t, tc.result)
954 })
955 }
956}
957
958func TestWebsocket_SetWriteDeadline(t *testing.T) {
959 type args struct {

Callers

nothing calls this directly

Calls 9

newMockReporterFunction · 0.85
newChainWithDefaultsFunction · 0.85
newMockConfigFunction · 0.85
newWebsocketFunction · 0.85
WithReadTimeoutMethod · 0.80
enterMethod · 0.80
setReadDeadlineMethod · 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…