(t *testing.T)
| 956 | } |
| 957 | |
| 958 | func 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 | |
| 1002 | func TestWebsocket_Disconnect(t *testing.T) { |
| 1003 | type args struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…