From 784e7c1fd5c8acb81ce08ad25a0443ace37d718d Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 14 Feb 2026 00:21:46 +0000 Subject: [PATCH] perf(test): reduce repeated image work in web auto-reply e2e --- ...y.compresses-common-formats-jpeg-cap.e2e.test.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/web/auto-reply.web-auto-reply.compresses-common-formats-jpeg-cap.e2e.test.ts b/src/web/auto-reply.web-auto-reply.compresses-common-formats-jpeg-cap.e2e.test.ts index 9f6c19cdf..dc97de3a3 100644 --- a/src/web/auto-reply.web-auto-reply.compresses-common-formats-jpeg-cap.e2e.test.ts +++ b/src/web/auto-reply.web-auto-reply.compresses-common-formats-jpeg-cap.e2e.test.ts @@ -160,6 +160,10 @@ describe("web auto-reply", () => { }, ] as const; + const width = 1200; + const height = 1200; + const sharedRaw = crypto.randomBytes(width * height * 3); + for (const fmt of formats) { // Force a small cap to ensure compression is exercised for every format. setLoadConfigMock(() => ({ agents: { defaults: { mediaMaxMb: 1 } } })); @@ -181,10 +185,7 @@ describe("web auto-reply", () => { return { close: vi.fn() }; }; - const width = 1200; - const height = 1200; - const raw = crypto.randomBytes(width * height * 3); - const big = await fmt.make(raw, { width, height }); + const big = await fmt.make(sharedRaw, { width, height }); expect(big.length).toBeGreaterThan(1 * 1024 * 1024); const fetchMock = vi.spyOn(globalThis, "fetch").mockResolvedValue({ @@ -244,8 +245,8 @@ describe("web auto-reply", () => { const bigPng = await sharp({ create: { - width: 2600, - height: 2600, + width: 1800, + height: 1800, channels: 3, background: { r: 0, g: 0, b: 255 }, },