Skip to content

Commit

Permalink
chore: updated test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Thesephi committed Dec 3, 2024
1 parent a05a85b commit 19f37f7
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions application.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1105,10 +1105,8 @@ Deno.test({
});

Deno.test({
name: "Application.listen() - no options",
name: "Application.listen() - no options - aborted before onListen",
// ignore: isNode(),
ignore: true, // there is a challenge with serve and the abort controller that
// needs to be isolated
async fn() {
const controller = new AbortController();
const app = new Application();
Expand All @@ -1118,6 +1116,22 @@ Deno.test({
const { signal } = controller;
const p = app.listen({ signal });
controller.abort();
assertRejects(async () => await p, "aborted prematurely before 'listen' event");
teardown();
},
});

Deno.test({
name: "Application.listen() - no options - aborted after onListen",
async fn() {
const controller = new AbortController();
const app = new Application();
app.use((ctx) => {
ctx.response.body = "hello world";
});
const { signal } = controller;
app.addEventListener("listen", () => controller.abort())
const p = app.listen({ signal });
await p;
teardown();
},
Expand Down

0 comments on commit 19f37f7

Please sign in to comment.