MCPcopy
hub / github.com/coder/websocket / TestWasmDialTimeout

Function TestWasmDialTimeout

ws_js_test.go:40–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestWasmDialTimeout(t *testing.T) {
41 t.Parallel()
42
43 ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
44 defer cancel()
45
46 beforeDial := time.Now()
47 _, _, err := websocket.Dial(ctx, "ws://example.com:9893", &websocket.DialOptions{
48 Subprotocols: []string{"echo"},
49 })
50 assert.Error(t, err)
51 if time.Since(beforeDial) >= time.Second {
52 t.Fatal("wasm context dial timeout is not working", time.Since(beforeDial))
53 }
54}

Callers

nothing calls this directly

Calls 2

DialFunction · 0.92
ErrorFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…