Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions apps/web/src/lib/imageCompression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading