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:
@@ -28,12 +28,11 @@
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { fixtureDir } from "../fixtures/index.js";
|
||||
import { buildTestApp, createMultipartPayload, loginAsAdmin, type TestApp } from "./test-server.js";
|
||||
|
||||
vi.setConfig({ testTimeout: 60_000 });
|
||||
|
||||
const FORMATS_DIR = join(__dirname, "..", "fixtures", "formats");
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Format definitions for the 16 primary formats
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -235,7 +234,7 @@ afterAll(async () => {
|
||||
// Helper: send a tool request and return the response
|
||||
// ---------------------------------------------------------------------------
|
||||
async function callTool(toolId: string, fmt: FormatDef, settings: Record<string, unknown>) {
|
||||
const fixturePath = join(FORMATS_DIR, fmt.file);
|
||||
const fixturePath = join(fixtureDir.formats, fmt.file);
|
||||
if (!existsSync(fixturePath)) {
|
||||
return null;
|
||||
}
|
||||
@@ -541,7 +540,7 @@ describe("Strip-metadata across all 16 primary formats", () => {
|
||||
it(
|
||||
`inspects ${fmt.name}`,
|
||||
async () => {
|
||||
const fixturePath = join(FORMATS_DIR, fmt.file);
|
||||
const fixturePath = join(fixtureDir.formats, fmt.file);
|
||||
if (!existsSync(fixturePath)) return;
|
||||
|
||||
const buffer = readFileSync(fixturePath);
|
||||
@@ -675,7 +674,7 @@ describe("Image enhancement across all 16 primary formats", () => {
|
||||
it(
|
||||
`analyzes ${fmt.name}`,
|
||||
async () => {
|
||||
const fixturePath = join(FORMATS_DIR, fmt.file);
|
||||
const fixturePath = join(fixtureDir.formats, fmt.file);
|
||||
if (!existsSync(fixturePath)) return;
|
||||
|
||||
const buffer = readFileSync(fixturePath);
|
||||
|
||||
Reference in New Issue
Block a user