fix: add 120s timeout to all HEIF/HEIC integration tests for CI

Comprehensively adds { timeout: 120_000 } to every HEIF/HEIC
integration test across 40 test files. HEIF decoding on CI runners
is significantly slower than local, causing sporadic timeouts at
the default 5s or previous 60s limits.
This commit is contained in:
SnapOtter
2026-05-01 19:51:47 +08:00
parent 6a44c455a3
commit d1f2f63453
42 changed files with 465 additions and 361 deletions
+28 -23
View File
@@ -413,7 +413,7 @@ describe("Find Duplicates", () => {
}
});
it("handles HEIC input images", async () => {
it("handles HEIC input images", { timeout: 120_000 }, async () => {
const HEIC = readFileSync(join(FIXTURES, "test-200x150.heic"));
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "a.heic", contentType: "image/heic", content: HEIC },
@@ -775,7 +775,7 @@ describe("Find Duplicates", () => {
// ── Branch coverage: HEIF content format input ─────────────────────
it("handles portrait HEIC images in duplicate detection", async () => {
it("handles portrait HEIC images in duplicate detection", { timeout: 120_000 }, async () => {
const HEIC_PORTRAIT = readFileSync(join(FIXTURES, "test-portrait.heic"));
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "a.heic", contentType: "image/heic", content: HEIC_PORTRAIT },
@@ -965,29 +965,34 @@ describe("Find Duplicates", () => {
// ── HEIF format input ─────────────────────────────────────────────
it("handles HEIF input images in duplicate detection", async () => {
const HEIF = readFileSync(join(FIXTURES, "content", "motorcycle.heif"));
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "a.heif", contentType: "image/heif", content: HEIF },
{ name: "file", filename: "b.heif", contentType: "image/heif", content: HEIF },
]);
it(
"handles HEIF input images in duplicate detection",
{ timeout: 120_000 },
async () => {
const HEIF = readFileSync(join(FIXTURES, "content", "motorcycle.heif"));
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "a.heif", contentType: "image/heif", content: HEIF },
{ name: "file", filename: "b.heif", contentType: "image/heif", content: HEIF },
]);
const res = await app.inject({
method: "POST",
url: "/api/v1/tools/find-duplicates",
headers: {
authorization: `Bearer ${adminToken}`,
"content-type": contentType,
},
body,
});
const res = await app.inject({
method: "POST",
url: "/api/v1/tools/find-duplicates",
headers: {
authorization: `Bearer ${adminToken}`,
"content-type": contentType,
},
body,
});
expect(res.statusCode).toBe(200);
const result = JSON.parse(res.body);
expect(result.totalImages).toBe(2);
expect(result.duplicateGroups).toHaveLength(1);
expect(result.duplicateGroups[0].files).toHaveLength(2);
}, 60_000);
expect(res.statusCode).toBe(200);
const result = JSON.parse(res.body);
expect(result.totalImages).toBe(2);
expect(result.duplicateGroups).toHaveLength(1);
expect(result.duplicateGroups[0].files).toHaveLength(2);
},
60_000,
);
// ── Animated GIF input ────────────────────────────────────────────