From 9d95260706cc948f1e0a709df0e1d25f5b9b72ee Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Wed, 12 Aug 2026 13:33:57 -0500 Subject: [PATCH] chore(test): nest the close({ timeoutMs }) case inside its describe block The test landed one line below the closing brace of describe('graceful shutdown'), so it ran at the top level instead of under the block it belongs to. Placement only; the assertions are untouched. Signed-off-by: Diego Resendez --- test/app.test.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/app.test.ts b/test/app.test.ts index bb97afe..02ff257 100644 --- a/test/app.test.ts +++ b/test/app.test.ts @@ -464,27 +464,27 @@ describe('graceful shutdown', () => { await expect(fetch(`http://127.0.0.1:${port}/ticks`).then((r) => r.text())).rejects.toThrow(); reader.cancel().catch(() => {}); }); -}); -it('close({ timeoutMs }) forces shutdown when a handler never responds', async () => { - @Route('/') - class Ctl { - @Get('/hang') hang() { - return new Promise(() => {}); // never resolves — simulates a stuck handler + it('close({ timeoutMs }) forces shutdown when a handler never responds', async () => { + @Route('/') + class Ctl { + @Get('/hang') hang() { + return new Promise(() => {}); // never resolves — simulates a stuck handler + } } - } - @Module({ mountpoint: '/', controllers: [Ctl] }) - class M {} - const app = createApp({ modules: [M] }); - const server = await app.listen(0); - const port = (server.address() as any).port; + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M] }); + const server = await app.listen(0); + const port = (server.address() as any).port; - fetch(`http://127.0.0.1:${port}/hang`).catch(() => {}); - await new Promise((r) => setTimeout(r, 50)); + fetch(`http://127.0.0.1:${port}/hang`).catch(() => {}); + await new Promise((r) => setTimeout(r, 50)); - const start = Date.now(); - await app.close({ timeoutMs: 300 }); - expect(Date.now() - start).toBeLessThan(600); + const start = Date.now(); + await app.close({ timeoutMs: 300 }); + expect(Date.now() - start).toBeLessThan(600); + }); }); describe('overrides', () => {