fix: correct corrupted-image test expectations and SVGZ watermark filename

Tests expected 422 for corrupted image data, but the API correctly
returns 400 since corruption is caught during validation (unrecognized
format), not during processing. Also fix watermark-image route passing
a hardcoded "watermark" string instead of the actual uploaded filename
to validateImageBuffer, which broke SVGZ detection.
This commit is contained in:
SnapOtter
2026-05-14 10:47:46 +08:00
parent bc0cac42e3
commit 98531db7ed
4 changed files with 12 additions and 11 deletions
+4 -5
View File
@@ -481,10 +481,9 @@ describe("Compare", () => {
body,
});
// Should return 422 due to processing failure
expect(res.statusCode).toBe(422);
expect(res.statusCode).toBe(400);
const result = JSON.parse(res.body);
expect(result.error).toMatch(/comparison failed/i);
expect(result.error).toMatch(/invalid/i);
});
// ── Branch coverage: 1x1 tiny images (line 117-121 area) ───────────
@@ -667,9 +666,9 @@ describe("Compare", () => {
body,
});
expect(res.statusCode).toBe(422);
expect(res.statusCode).toBe(400);
const result = JSON.parse(res.body);
expect(result.error).toMatch(/comparison failed/i);
expect(result.error).toMatch(/invalid/i);
});
// ── Branch coverage: HEIF content format input ─────────────────────