summaryrefslogtreecommitdiff
path: root/cli/tests/unit/http_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/http_test.ts')
-rw-r--r--cli/tests/unit/http_test.ts17
1 files changed, 8 insertions, 9 deletions
diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts
index ac3b3d66f..b7c6169d8 100644
--- a/cli/tests/unit/http_test.ts
+++ b/cli/tests/unit/http_test.ts
@@ -8,7 +8,6 @@ import {
assertRejects,
assertStrictEquals,
assertThrows,
- deferred,
delay,
fail,
} from "./test_util.ts";
@@ -592,9 +591,9 @@ Deno.test(
let counter = 0;
const deferreds = [
- deferred(),
- deferred(),
- deferred(),
+ Promise.withResolvers<void>(),
+ Promise.withResolvers<void>(),
+ Promise.withResolvers<void>(),
];
async function writeRequest(conn: Deno.Conn) {
@@ -639,7 +638,7 @@ Deno.test(
return controller.close();
}
- await deferreds[counter - 1];
+ await deferreds[counter - 1].promise;
controller.enqueue(`${counter}\n`);
counter++;
@@ -795,13 +794,13 @@ Deno.test({ permissions: { net: true } }, async function httpServerWebSocket() {
await close;
})();
- const def = deferred();
+ const def = Promise.withResolvers<void>();
const ws = new WebSocket(`ws://localhost:${listenPort}`);
ws.onmessage = (m) => assertEquals(m.data, "foo");
ws.onerror = () => fail();
ws.onclose = () => def.resolve();
ws.onopen = () => ws.send("foo");
- await def;
+ await def.promise;
await promise;
});
@@ -2287,7 +2286,7 @@ Deno.test("upgradeHttp unix", {
ignore: Deno.build.os === "windows",
}, async () => {
const filePath = tmpUnixSocketPath();
- const promise = deferred();
+ const { promise, resolve } = Promise.withResolvers<void>();
async function client() {
const unixConn = await Deno.connect({ path: filePath, transport: "unix" });
@@ -2303,7 +2302,7 @@ Deno.test("upgradeHttp unix", {
),
);
unixConn.close();
- promise.resolve();
+ resolve();
}, 500);
await promise;
}