mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test: migrate 207 test files to typed fixture registry (phase 5)
Codemod rewrites all five ad-hoc fixture-path styles to import from the typed registry (tests/fixtures/index.ts): - join(__dirname, "..", "fixtures", ...) inline patterns (100 files) - const FIXTURES = join(__dirname, ...) + join(FIXTURES, ...) (92 files) - process.cwd()-based paths (10 files) - path.resolve(__dirname, ...) patterns (5 files) Registry extended with 8 new keys (portraitJpg, portraitHeic, motorcycle, svgLogo, barcodeAvif, qrAvif, crossFormatChat, multipageTiff) and directory accessors (fixtureDir, fixtureRoot). Dynamic directory scanners (format-matrix-generated, format-matrix-multimodal, hostile-inputs) preserved via fixtureDir imports. No fixtures swapped, bytes identical. Parity gate: dropped 0, net-new 388.
This commit is contained in:
@@ -7,20 +7,18 @@
|
||||
* the sidecar.
|
||||
*/
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import sharp from "sharp";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { fixtures, readFixture } from "../fixtures/index.js";
|
||||
import { buildTestApp, createMultipartPayload, loginAsAdmin, type TestApp } from "./test-server.js";
|
||||
|
||||
const FIXTURES = join(__dirname, "..", "fixtures");
|
||||
const FAKE_TRANSPARENCY = readFileSync(join(FIXTURES, "test-fake-transparency.png"));
|
||||
const PNG = readFileSync(join(FIXTURES, "test-200x150.png"));
|
||||
const JPG = readFileSync(join(FIXTURES, "test-100x100.jpg"));
|
||||
const WEBP = readFileSync(join(FIXTURES, "test-50x50.webp"));
|
||||
const SVG = readFileSync(join(FIXTURES, "test-100x100.svg"));
|
||||
const HEIC = readFileSync(join(FIXTURES, "test-200x150.heic"));
|
||||
const TINY = readFileSync(join(FIXTURES, "test-1x1.png"));
|
||||
const FAKE_TRANSPARENCY = readFixture(fixtures.image.transparent);
|
||||
const PNG = readFixture(fixtures.image.base.png200);
|
||||
const JPG = readFixture(fixtures.image.base.jpg100);
|
||||
const WEBP = readFixture(fixtures.image.base.webp50);
|
||||
const SVG = readFixture(fixtures.image.base.svg100);
|
||||
const HEIC = readFixture(fixtures.image.base.heic200);
|
||||
const TINY = readFixture(fixtures.image.edge.px1);
|
||||
|
||||
const TOOL_URL = "/api/v1/tools/transparency-fixer";
|
||||
|
||||
@@ -306,7 +304,7 @@ describe("PNG Transparency Fixer - Watermark removal settings", () => {
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
describe("PNG Transparency Fixer - Large file", () => {
|
||||
it("handles stress-large.jpg input", async () => {
|
||||
const LARGE = readFileSync(join(FIXTURES, "content", "stress-large.jpg"));
|
||||
const LARGE = readFixture(fixtures.image.stressLarge);
|
||||
const res = await postTransparencyFixer(LARGE, "stress-large.jpg", {});
|
||||
expect([200, 202, 501]).toContain(res.statusCode);
|
||||
}, 120_000);
|
||||
@@ -353,7 +351,7 @@ describe("PNG Transparency Fixer - Authentication", () => {
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
describe("PNG Transparency Fixer - HEIF input", () => {
|
||||
it("accepts HEIF (sample.heif) input", { timeout: 120_000 }, async () => {
|
||||
const HEIF = readFileSync(join(FIXTURES, "formats", "sample.heif"));
|
||||
const HEIF = readFixture(fixtures.image.formats("heif"));
|
||||
const res = await postTransparencyFixer(HEIF, "sample.heif", {});
|
||||
expect([200, 202, 422, 501]).toContain(res.statusCode);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user