0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -05:00

chore(ext/http): fix a rejection test (#20514)

Use `assertRejects` to actually catch errors.
This commit is contained in:
Matt Mastracci 2023-09-15 08:53:38 -06:00 committed by GitHub
parent 71af3c375c
commit d226970c0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -967,12 +967,9 @@ function createStreamTest(count: number, delay: number, action: string) {
await listeningPromise;
const resp = await fetch(`http://127.0.0.1:${servePort}/`);
if (action == "Throw") {
try {
await assertRejects(async () => {
await resp.text();
fail();
} catch (_) {
// expected
}
});
} else {
const text = await resp.text();
@ -985,7 +982,7 @@ function createStreamTest(count: number, delay: number, action: string) {
}
} finally {
ac.abort();
await server.finished;
await server.shutdown();
}
});
}