From 5a1505db67d0326bf37b765c8a566584b44a2c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 15 Sep 2023 21:51:25 +0200 Subject: 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 --- cli/tests/unit/websocket_test.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'cli/tests/unit') 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 }) => { -- cgit v1.2.3