test: expand test coverage across all layers (+1,157 tests)

Fix 2 failing unit tests (landing hero text mismatch) and broken
coverage tooling (brace-expansion v5 override breaking minimatch).
Add ~1,097 new test cases via 14-agent parallel expansion:

- Unit: +290 tests (AI bridge, image-engine, stores, API helpers)
- Integration: +504 tests (all tools, cross-format matrix, adversarial)
- E2E: +363 tests (navigation, tool UI, batch/pipeline, settings,
  visual regression, accessibility, performance, cross-browser)

Total: 4,223 unit + 6,057 integration + 1,563 E2E = 11,843 tests
This commit is contained in:
SnapOtter
2026-06-06 19:37:29 +08:00
parent 66e503730d
commit 06d1822491
67 changed files with 20114 additions and 49 deletions
+120
View File
@@ -1653,4 +1653,124 @@ describe("Split", () => {
expect(res.statusCode).toBe(400);
});
// ── AVIF format input ─────────────────────────────────────────────
it("splits an AVIF input image", async () => {
const AVIF = readFileSync(join(FIXTURES, "formats", "sample.avif"));
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "photo.avif", contentType: "image/avif", content: AVIF },
{
name: "settings",
content: JSON.stringify({ columns: 2, rows: 2, outputFormat: "png" }),
},
]);
const res = await app.inject({
method: "POST",
url: "/api/v1/tools/split",
headers: {
authorization: `Bearer ${adminToken}`,
"content-type": contentType,
},
body,
});
expect(res.statusCode).toBe(200);
const zip = new AdmZip(res.rawPayload);
const entries = zip.getEntries();
expect(entries.length).toBe(4);
for (const entry of entries) {
expect(entry.entryName).toMatch(/\.png$/);
const meta = await sharp(entry.getData()).metadata();
expect(meta.format).toBe("png");
expect(meta.width).toBeGreaterThan(0);
expect(meta.height).toBeGreaterThan(0);
}
});
// ── SVGZ input ───────────────────────────────────────────────────
it("splits a SVGZ (compressed SVG) input image", async () => {
const SVGZ = readFileSync(join(FIXTURES, "formats", "sample.svgz"));
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "icon.svgz", contentType: "image/svg+xml", content: SVGZ },
{
name: "settings",
content: JSON.stringify({ columns: 2, rows: 2, outputFormat: "png" }),
},
]);
const res = await app.inject({
method: "POST",
url: "/api/v1/tools/split",
headers: {
authorization: `Bearer ${adminToken}`,
"content-type": contentType,
},
body,
});
expect(res.statusCode).toBe(200);
const zip = new AdmZip(res.rawPayload);
const entries = zip.getEntries();
expect(entries.length).toBe(4);
});
// ── Rows at boundary minimum (1) with columns at max (100) ──────
it("splits into 100 columns x 1 row (max columns)", async () => {
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "test.png", contentType: "image/png", content: PNG },
{
name: "settings",
content: JSON.stringify({ columns: 100, rows: 1 }),
},
]);
const res = await app.inject({
method: "POST",
url: "/api/v1/tools/split",
headers: {
authorization: `Bearer ${adminToken}`,
"content-type": contentType,
},
body,
});
expect(res.statusCode).toBe(200);
const zip = new AdmZip(res.rawPayload);
const entries = zip.getEntries();
expect(entries.length).toBe(100);
});
// ── Quality at max boundary (100) ────────────────────────────────
it("accepts quality at maximum (100)", async () => {
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "test.png", contentType: "image/png", content: PNG },
{
name: "settings",
content: JSON.stringify({ columns: 2, rows: 1, outputFormat: "webp", quality: 100 }),
},
]);
const res = await app.inject({
method: "POST",
url: "/api/v1/tools/split",
headers: {
authorization: `Bearer ${adminToken}`,
"content-type": contentType,
},
body,
});
expect(res.statusCode).toBe(200);
const zip = new AdmZip(res.rawPayload);
const entries = zip.getEntries();
expect(entries.length).toBe(2);
for (const entry of entries) {
expect(entry.entryName).toMatch(/\.webp$/);
}
});
});