mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test: deepen integration tests for 11 medium tools (HEIC, large file, batch, edge cases)
This commit is contained in:
@@ -627,6 +627,59 @@ describe("favicon", () => {
|
||||
expect(manifest.name).toBe("my.app.logo");
|
||||
});
|
||||
|
||||
// ── Animated GIF input ────────────────────────────────────────────
|
||||
|
||||
it("generates favicons from animated GIF input", async () => {
|
||||
const GIF = readFileSync(join(FIXTURES, "animated.gif"));
|
||||
const { body, contentType } = createMultipartPayload([
|
||||
{ name: "file", filename: "anim.gif", contentType: "image/gif", content: GIF },
|
||||
]);
|
||||
|
||||
const res = await app.inject({
|
||||
method: "POST",
|
||||
url: "/api/v1/tools/favicon",
|
||||
headers: { authorization: `Bearer ${adminToken}`, "content-type": contentType },
|
||||
body,
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(200);
|
||||
const zip = new AdmZip(Buffer.from(res.rawPayload));
|
||||
const entries = zip.getEntries().map((e) => e.entryName);
|
||||
expect(entries).toContain("favicon-16x16.png");
|
||||
expect(entries).toContain("favicon.ico");
|
||||
});
|
||||
|
||||
// ── Batch: 5+ images ────────────────────────────────────────────
|
||||
|
||||
it("generates favicons for 5 images in subfolders", async () => {
|
||||
const JPG = readFileSync(join(FIXTURES, "test-100x100.jpg"));
|
||||
const WEBP = readFileSync(join(FIXTURES, "test-50x50.webp"));
|
||||
const TINY = readFileSync(join(FIXTURES, "test-1x1.png"));
|
||||
const { body, contentType } = createMultipartPayload([
|
||||
{ name: "file", filename: "a.png", contentType: "image/png", content: PNG },
|
||||
{ name: "file", filename: "b.jpg", contentType: "image/jpeg", content: JPG },
|
||||
{ name: "file", filename: "c.webp", contentType: "image/webp", content: WEBP },
|
||||
{ name: "file", filename: "d.png", contentType: "image/png", content: TINY },
|
||||
{ name: "file", filename: "e.png", contentType: "image/png", content: PNG },
|
||||
]);
|
||||
|
||||
const res = await app.inject({
|
||||
method: "POST",
|
||||
url: "/api/v1/tools/favicon",
|
||||
headers: { authorization: `Bearer ${adminToken}`, "content-type": contentType },
|
||||
body,
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(200);
|
||||
const zip = new AdmZip(Buffer.from(res.rawPayload));
|
||||
const entries = zip.getEntries().map((e) => e.entryName);
|
||||
expect(entries.some((e) => e.startsWith("a/"))).toBe(true);
|
||||
expect(entries.some((e) => e.startsWith("b/"))).toBe(true);
|
||||
expect(entries.some((e) => e.startsWith("c/"))).toBe(true);
|
||||
expect(entries.some((e) => e.startsWith("d/"))).toBe(true);
|
||||
expect(entries.some((e) => e.startsWith("e/"))).toBe(true);
|
||||
});
|
||||
|
||||
// ── HEIF format input ────────────────────────────────────────────
|
||||
|
||||
it("generates favicons from HEIF input", async () => {
|
||||
|
||||
Reference in New Issue
Block a user