perf(test): speed up screenshot normalization e2e fixture

This commit is contained in:
Peter Steinberger
2026-02-14 00:16:38 +00:00
parent 93dc3bb79a
commit 212da860a9

View File

@@ -1,14 +1,17 @@
import crypto from "node:crypto";
import sharp from "sharp";
import { describe, expect, it } from "vitest";
import { normalizeBrowserScreenshot } from "./screenshot.js";
describe("browser screenshot normalization", () => {
it("shrinks oversized images to <=2000x2000 and <=5MB", async () => {
const width = 2300;
const height = 2300;
const raw = crypto.randomBytes(width * height * 3);
const bigPng = await sharp(raw, { raw: { width, height, channels: 3 } })
const bigPng = await sharp({
create: {
width: 2100,
height: 2100,
channels: 3,
background: { r: 12, g: 34, b: 56 },
},
})
.png({ compressionLevel: 0 })
.toBuffer();