From 177c50c362a1cf69dc5b0d3b72ac813fff9c7590 Mon Sep 17 00:00:00 2001 From: snowykr Date: Wed, 5 Aug 2026 14:45:53 +0000 Subject: [PATCH] test(web): shrink imageCompression too-large fixture instead of raising timeout --- apps/web/src/lib/imageCompression.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/web/src/lib/imageCompression.test.ts b/apps/web/src/lib/imageCompression.test.ts index 63712ca7e29..b99dd9a67ed 100644 --- a/apps/web/src/lib/imageCompression.test.ts +++ b/apps/web/src/lib/imageCompression.test.ts @@ -123,9 +123,12 @@ describe("compressImageForStash", () => { }); it("reports too-large when even the smallest encoding overflows the budget", async () => { - const { close } = stubCanvasPipeline(() => 8_000_000); + // A small test-only budget keeps the fixture cheap: every encode in the + // ladder overflows it, so the give-up path runs without materializing + // multi-megabyte base64 payloads on every quality step. + const { close } = stubCanvasPipeline(() => 300_000); - const result = await compressImageForStash(makeFile(9_000_000)); + const result = await compressImageForStash(makeFile(9_000_000), 150_000); expect(result).toEqual({ ok: false, reason: "too-large" }); // The bitmap must still be released on the give-up path.