test: deepen integration tests for 6 simpler tools (HEIC, large file, batch, edge cases)

This commit is contained in:
SnapOtter
2026-05-01 02:46:04 +08:00
parent 710b580cee
commit 270f54950d
5 changed files with 351 additions and 0 deletions
+27
View File
@@ -587,6 +587,33 @@ describe("Info", () => {
expect(typeof result.hasXmp).toBe("boolean");
});
// ── HEIF format info ──────────────────────────────────────────
it("returns correct metadata for HEIF (sample.heif) image", async () => {
const HEIF = readFileSync(join(FIXTURES, "formats", "sample.heif"));
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "sample.heif", contentType: "image/heif", content: HEIF },
]);
const res = await app.inject({
method: "POST",
url: "/api/v1/tools/info",
headers: {
authorization: `Bearer ${adminToken}`,
"content-type": contentType,
},
body,
});
// HEIF might need system decoder -- skip if 422
if (res.statusCode === 422) return;
expect(res.statusCode).toBe(200);
const result = JSON.parse(res.body);
expect(result.width).toBeGreaterThan(0);
expect(result.height).toBeGreaterThan(0);
expect(result.filename).toBe("sample.heif");
});
// ── Alpha channel detection ─────────────────────────────────────
it("detects alpha channel in PNG with transparency", async () => {