Skip to content

Commit eef5dce

Browse files
committed
test(cleanup-lifecycle): wait for download destroy
1 parent 19c45ee commit eef5dce

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tests/cleanup-lifecycle.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ describe('cleanup lifecycle', () => {
285285
.execute()
286286

287287
await vi.advanceTimersByTimeAsync(30_000)
288+
// The renewal fires on the fake timer, but the lease-lost DB query resolves on a
289+
// real round-trip — wait for the resulting destroy instead of asserting synchronously.
290+
// Plain 'close' wait (not events.once, which rejects on the error-destroy).
291+
if (!download!.destroyed) await new Promise((resolve) => download!.once('close', resolve))
288292

289293
expect(download!.destroyed).toBe(true)
290294
} finally {

0 commit comments

Comments
 (0)