diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-09-15 08:53:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-15 08:53:38 -0600 |
commit | d226970c0ed1e5a9691b7f22a91792b3e6955d9c (patch) | |
tree | e76e28b5d6d3c177d2416e17e1a376b4c657b4d4 | |
parent | 71af3c375c229e3311e4c82350025d1955cfa123 (diff) |
chore(ext/http): fix a rejection test (#20514)
Use `assertRejects` to actually catch errors.
-rw-r--r-- | cli/tests/unit/serve_test.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/cli/tests/unit/serve_test.ts b/cli/tests/unit/serve_test.ts index 76433f1e3..cfe74e659 100644 --- a/cli/tests/unit/serve_test.ts +++ b/cli/tests/unit/serve_test.ts @@ -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(); } }); } |