(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestWasm(t *testing.T) { |
| 16 | t.Parallel() |
| 17 | |
| 18 | ctx, cancel := context.WithTimeout(context.Background(), time.Minute) |
| 19 | defer cancel() |
| 20 | |
| 21 | c, resp, err := websocket.Dial(ctx, os.Getenv("WS_ECHO_SERVER_URL"), &websocket.DialOptions{ |
| 22 | Subprotocols: []string{"echo"}, |
| 23 | }) |
| 24 | assert.Success(t, err) |
| 25 | defer c.Close(websocket.StatusInternalError, "") |
| 26 | |
| 27 | assert.Equal(t, "subprotocol", "echo", c.Subprotocol()) |
| 28 | assert.Equal(t, "response code", http.StatusSwitchingProtocols, resp.StatusCode) |
| 29 | |
| 30 | c.SetReadLimit(65536) |
| 31 | for range 10 { |
| 32 | err = wstest.Echo(ctx, c, 65536) |
| 33 | assert.Success(t, err) |
| 34 | } |
| 35 | |
| 36 | err = c.Close(websocket.StatusNormalClosure, "") |
| 37 | assert.Success(t, err) |
| 38 | } |
| 39 | |
| 40 | func TestWasmDialTimeout(t *testing.T) { |
| 41 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…