good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 65dfbdd4 authored by Anmol Sethi's avatar Anmol Sethi
Browse files

wasm: Add dial timeout test

parent 6840778f
No related branches found
No related tags found
No related merge requests found
......@@ -36,3 +36,19 @@ func TestWasm(t *testing.T) {
err = c.Close(websocket.StatusNormalClosure, "")
assert.Success(t, err)
}
func TestWasmDialTimeout(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
defer cancel()
beforeDial := time.Now()
_, _, err := websocket.Dial(ctx, "ws://example.com:9893", &websocket.DialOptions{
Subprotocols: []string{"echo"},
})
assert.Error(t, err)
if time.Since(beforeDial) >= time.Second {
t.Fatal("wasm context dial timeout is not working", time.Since(beforeDial))
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment