Skip to content

Commit 19f37f7

Browse files
committed
chore: updated test suite
1 parent a05a85b commit 19f37f7

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

application.test.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,10 +1105,8 @@ Deno.test({
11051105
});
11061106

11071107
Deno.test({
1108-
name: "Application.listen() - no options",
1108+
name: "Application.listen() - no options - aborted before onListen",
11091109
// ignore: isNode(),
1110-
ignore: true, // there is a challenge with serve and the abort controller that
1111-
// needs to be isolated
11121110
async fn() {
11131111
const controller = new AbortController();
11141112
const app = new Application();
@@ -1118,6 +1116,22 @@ Deno.test({
11181116
const { signal } = controller;
11191117
const p = app.listen({ signal });
11201118
controller.abort();
1119+
assertRejects(async () => await p, "aborted prematurely before 'listen' event");
1120+
teardown();
1121+
},
1122+
});
1123+
1124+
Deno.test({
1125+
name: "Application.listen() - no options - aborted after onListen",
1126+
async fn() {
1127+
const controller = new AbortController();
1128+
const app = new Application();
1129+
app.use((ctx) => {
1130+
ctx.response.body = "hello world";
1131+
});
1132+
const { signal } = controller;
1133+
app.addEventListener("listen", () => controller.abort())
1134+
const p = app.listen({ signal });
11211135
await p;
11221136
teardown();
11231137
},

0 commit comments

Comments
 (0)