Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -0,0 +1,28 @@
import { describe, expect, test } from "vitest";
import {
assertPreviewOutputSize,
assertPreviewRasterMetadata,
assertPreviewSourceSize,
FILE_PREVIEW_MAX_DIMENSION,
FILE_PREVIEW_MAX_PAGES,
FILE_PREVIEW_MAX_PIXELS,
FILE_PREVIEW_MAX_SOURCE_BYTES,
} from "./file-preview-decoder-contract.js";
describe("file preview decoder limits", () => {
test("accepts a normal single-page image", () => {
expect(() => assertPreviewRasterMetadata({ width: 4_000, height: 3_000, pages: 1 })).not.toThrow();
});
test("rejects decompression-bomb dimensions, pixels and page counts", () => {
expect(() => assertPreviewRasterMetadata({ width: FILE_PREVIEW_MAX_DIMENSION + 1, height: 1 })).toThrow("dimension limit");
expect(() => assertPreviewRasterMetadata({ width: 10_000, height: Math.floor(FILE_PREVIEW_MAX_PIXELS / 10_000) + 1 })).toThrow("pixel limit");
expect(() => assertPreviewRasterMetadata({ width: 1, height: 1, pages: FILE_PREVIEW_MAX_PAGES + 1 })).toThrow("page limit");
});
test("rejects oversized source and generated output buffers", () => {
expect(() => assertPreviewSourceSize(FILE_PREVIEW_MAX_SOURCE_BYTES + 1)).toThrow("byte limit");
expect(() => assertPreviewOutputSize(11, 10, "fixture")).toThrow("output limit");
});
});