mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 01:44:26 -05:00
chore(ext/http): fix a rejection test (#20514)
Use `assertRejects` to actually catch errors.
This commit is contained in:
parent
71af3c375c
commit
d226970c0e
1 changed files with 3 additions and 6 deletions
|
@ -967,12 +967,9 @@ function createStreamTest(count: number, delay: number, action: string) {
|
||||||
await listeningPromise;
|
await listeningPromise;
|
||||||
const resp = await fetch(`http://127.0.0.1:${servePort}/`);
|
const resp = await fetch(`http://127.0.0.1:${servePort}/`);
|
||||||
if (action == "Throw") {
|
if (action == "Throw") {
|
||||||
try {
|
await assertRejects(async () => {
|
||||||
await resp.text();
|
await resp.text();
|
||||||
fail();
|
});
|
||||||
} catch (_) {
|
|
||||||
// expected
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const text = await resp.text();
|
const text = await resp.text();
|
||||||
|
|
||||||
|
@ -985,7 +982,7 @@ function createStreamTest(count: number, delay: number, action: string) {
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
ac.abort();
|
ac.abort();
|
||||||
await server.finished;
|
await server.shutdown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue