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:
@@ -5,13 +5,12 @@
|
||||
* the factory (route registration, file collection, per-file prepare,
|
||||
* inputRefs on the durable row, and the too-many-files rejection).
|
||||
*/
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { TOOLS } from "@snapotter/shared";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { db, schema } from "../../apps/api/src/db/index.js";
|
||||
import { createToolRoute } from "../../apps/api/src/routes/tool-factory.js";
|
||||
import { fixtures, readFixture } from "../fixtures/index.js";
|
||||
import {
|
||||
buildTestApp,
|
||||
createMultipartPayload,
|
||||
@@ -20,10 +19,10 @@ import {
|
||||
type TestApp,
|
||||
} from "./test-server.js";
|
||||
|
||||
const PNG = readFileSync(join(__dirname, "..", "fixtures", "test-1x1.png"));
|
||||
const PNG_A = readFileSync(join(__dirname, "..", "fixtures", "test-1x1.png"));
|
||||
const PNG_B = readFileSync(join(__dirname, "..", "fixtures", "test-200x150.png"));
|
||||
const PNG_C = readFileSync(join(__dirname, "..", "fixtures", "test-blank.png"));
|
||||
const PNG = readFixture(fixtures.image.edge.px1);
|
||||
const PNG_A = readFixture(fixtures.image.edge.px1);
|
||||
const PNG_B = readFixture(fixtures.image.base.png200);
|
||||
const PNG_C = readFixture(fixtures.image.edge.blank);
|
||||
|
||||
// Minimal schema stand-in that satisfies the factory's safeParse call
|
||||
// without pulling in a zod dependency at the test root.
|
||||
|
||||
Reference in New Issue
Block a user