From 930cb0afd8c7e7b8f85051156c716119eceeeb37 Mon Sep 17 00:00:00 2001 From: Craig Morten Date: Sun, 5 Sep 2021 21:43:46 +0100 Subject: [PATCH] chore(std/http): server module name migration (#11890) --- .github/workflows/ci.yml | 2 +- cli/bench/deno_http_proxy.ts | 2 +- cli/tests/testdata/045_proxy_test.ts | 5 ++++- cli/tests/unit/http_test.ts | 15 ++++++++------- cli/tests/unit/test_util.ts | 1 + test_util/std | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cf411c9e3..fe8ba756c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,7 +89,7 @@ jobs: - name: Install Deno if: matrix.job == 'lint' run: | - curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.11.3 + curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.13.2 echo "$HOME/.deno/bin" >> $GITHUB_PATH - name: Install Python diff --git a/cli/bench/deno_http_proxy.ts b/cli/bench/deno_http_proxy.ts index fc756f80fd..7295baff5c 100644 --- a/cli/bench/deno_http_proxy.ts +++ b/cli/bench/deno_http_proxy.ts @@ -1,5 +1,5 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { serve, ServerRequest } from "../test_util/std/http/server.ts"; +import { serve, ServerRequest } from "../test_util/std/http/server_legacy.ts"; const addr = Deno.args[0] || "127.0.0.1:4500"; const originAddr = Deno.args[1] || "127.0.0.1:4501"; diff --git a/cli/tests/testdata/045_proxy_test.ts b/cli/tests/testdata/045_proxy_test.ts index 6d8359518f..1433b426a2 100644 --- a/cli/tests/testdata/045_proxy_test.ts +++ b/cli/tests/testdata/045_proxy_test.ts @@ -1,5 +1,8 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { serve, ServerRequest } from "../../../test_util/std/http/server.ts"; +import { + serve, + ServerRequest, +} from "../../../test_util/std/http/server_legacy.ts"; import { assertEquals } from "../../../test_util/std/testing/asserts.ts"; const addr = Deno.args[1] || "127.0.0.1:4555"; diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts index 6805318763..ccacfd751d 100644 --- a/cli/tests/unit/http_test.ts +++ b/cli/tests/unit/http_test.ts @@ -6,8 +6,8 @@ import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts"; import { assert, assertEquals, + assertRejects, assertThrows, - assertThrowsAsync, deferred, delay, fail, @@ -187,7 +187,7 @@ unitTest({ perms: { net: true } }, async function httpServerInvalidMethod() { const client = await Deno.connect({ port: 4501 }); const httpConn = Deno.serveHttp(await listener.accept()); await client.write(new Uint8Array([1, 2, 3])); - await assertThrowsAsync( + await assertRejects( async () => { await httpConn.nextRequest(); }, @@ -277,8 +277,8 @@ unitTest( const event = await httpConn.nextRequest(); assert(event); const { respondWith } = event; - let cancelReason = null; - const responseError = await assertThrowsAsync( + let cancelReason: string; + await assertRejects( async () => { let interval = 0; await respondWith( @@ -299,8 +299,9 @@ unitTest( ); }, Deno.errors.Http, + cancelReason!, ); - assertEquals(cancelReason, responseError); + assert(cancelReason!); httpConn.close(); listener.close(); })(); @@ -323,7 +324,7 @@ unitTest( // Start polling for the next request before awaiting response. const nextRequestPromise = httpConn.nextRequest(); const { respondWith } = event; - await assertThrowsAsync( + await assertRejects( async () => { let interval = 0; await respondWith( @@ -710,7 +711,7 @@ unitTest(function httpUpgradeWebSocketCaseInsensitiveUpgradeHeader() { const request = new Request("https://deno.land/", { headers: { connection: "upgrade", - upgrade: "WebSocket", + upgrade: "websocket", "sec-websocket-key": "dGhlIHNhbXBsZSBub25jZQ==", }, }); diff --git a/cli/tests/unit/test_util.ts b/cli/tests/unit/test_util.ts index 6745946c66..6508abd202 100644 --- a/cli/tests/unit/test_util.ts +++ b/cli/tests/unit/test_util.ts @@ -12,6 +12,7 @@ export { assertEquals, assertMatch, assertNotEquals, + assertRejects, assertStrictEquals, assertStringIncludes, assertThrows, diff --git a/test_util/std b/test_util/std index 81314bcab8..ca23a1e603 160000 --- a/test_util/std +++ b/test_util/std @@ -1 +1 @@ -Subproject commit 81314bcab8b5dc2fef85ec65f8588cab17063378 +Subproject commit ca23a1e6035ebf34152ab1f20b46f1c3c9a11a5b