diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-09-15 21:51:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-15 21:51:25 +0200 |
| commit | 5a1505db67d0326bf37b765c8a566584b44a2c1a (patch) | |
| tree | 4f1cadc6bc85f8538cc0c21ebc7354e404d48bcf /cli/tests/unit | |
| parent | 11f0ccf8052065e37f92d8ba43e9624fcd3b9814 (diff) | |
feat(ext/node): http2.connect() API (#19671)
This commit improves compatibility of "node:http2" module by polyfilling
"connect" method and "ClientHttp2Session" class. Basic operations like
streaming, header and trailer handling are working correctly.
Refing/unrefing is still a TODO and "npm:grpc-js/grpc" is not yet working
correctly.
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Diffstat (limited to 'cli/tests/unit')
| -rw-r--r-- | cli/tests/unit/websocket_test.ts | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/cli/tests/unit/websocket_test.ts b/cli/tests/unit/websocket_test.ts index ac33f9d69..11f0fd7dc 100644 --- a/cli/tests/unit/websocket_test.ts +++ b/cli/tests/unit/websocket_test.ts @@ -7,6 +7,9 @@ import { fail, } from "./test_util.ts"; +const servePort = 4248; +const serveUrl = `ws://localhost:${servePort}/`; + Deno.test({ permissions: "none" }, function websocketPermissionless() { assertThrows( () => new WebSocket("ws://localhost"), @@ -81,13 +84,13 @@ Deno.test( signal: ac.signal, onListen: () => listeningPromise.resolve(), hostname: "localhost", - port: 4246, + port: servePort, }); await listeningPromise; const promise = deferred(); - const ws = new WebSocket("ws://localhost:4246/"); - assertEquals(ws.url, "ws://localhost:4246/"); + const ws = new WebSocket(serveUrl); + assertEquals(ws.url, serveUrl); ws.onerror = () => fail(); ws.onmessage = (e) => { assertEquals(e.data, "Hello"); @@ -133,13 +136,13 @@ Deno.test({ signal: ac.signal, onListen: () => listeningPromise.resolve(), hostname: "localhost", - port: 4247, + port: servePort, }); await listeningPromise; - const ws = new WebSocket("ws://localhost:4247/"); - assertEquals(ws.url, "ws://localhost:4247/"); + const ws = new WebSocket(serveUrl); + assertEquals(ws.url, serveUrl); ws.onerror = () => fail(); ws.onmessage = () => ws.send("bye"); ws.onclose = () => { @@ -173,13 +176,13 @@ Deno.test({ signal: ac.signal, onListen: () => listeningPromise.resolve(), hostname: "localhost", - port: 4247, + port: servePort, }); await listeningPromise; - const ws = new WebSocket("ws://localhost:4247/"); - assertEquals(ws.url, "ws://localhost:4247/"); + const ws = new WebSocket(serveUrl); + assertEquals(ws.url, serveUrl); let seenBye = false; ws.onerror = () => fail(); ws.onmessage = ({ data }) => { |
