summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/bench/deno_http_proxy.ts2
-rw-r--r--cli/tests/testdata/045_proxy_test.ts5
-rw-r--r--cli/tests/unit/http_test.ts15
-rw-r--r--cli/tests/unit/test_util.ts1
4 files changed, 14 insertions, 9 deletions
diff --git a/cli/bench/deno_http_proxy.ts b/cli/bench/deno_http_proxy.ts
index fc756f80f..7295baff5 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 6d8359518..1433b426a 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 680531876..ccacfd751 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 6745946c6..6508abd20 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,