test: reorganize fixture files into modality-first layout (phase 6b)

Move all fixture files from flat/mixed dirs (content/, media/, documents/,
formats/, hostile/, root loose) into the modality-first hierarchy:
image/{valid,formats,edge,hostile}, video/{valid,formats,hostile},
audio/{valid,formats,hostile}, document/{valid,formats,edge,hostile},
data/valid/, security/. Update index.ts paths, fixtureDir aliases,
all literal refs in 17 e2e/qa/script files, manifest.json, and the
three generator scripts. 163 files moved, 0 dropped, 100 new tests
from expanded document scan.
This commit is contained in:
SnapOtter
2026-06-20 05:51:17 +08:00
parent 1727a7a73e
commit 941ed27912
199 changed files with 560 additions and 429 deletions
+11 -9
View File
@@ -13,9 +13,11 @@ import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = join(__dirname, "..");
const mediaDir = join(root, "tests/fixtures/media");
const docsDir = join(root, "tests/fixtures/documents");
mkdirSync(mediaDir, { recursive: true });
const videoDir = join(root, "tests/fixtures/video/formats");
const audioDir = join(root, "tests/fixtures/audio/formats");
const docsDir = join(root, "tests/fixtures/document/formats");
mkdirSync(videoDir, { recursive: true });
mkdirSync(audioDir, { recursive: true });
mkdirSync(docsDir, { recursive: true });
const ffmpeg = process.env.FFMPEG_PATH || "ffmpeg";
@@ -58,7 +60,7 @@ run([
"-b:a",
"32k",
"-shortest",
join(mediaDir, "tiny.mp4"),
join(videoDir, "tiny.mp4"),
]);
// 1s sine mp3
run([
@@ -70,7 +72,7 @@ run([
"libmp3lame",
"-b:a",
"32k",
join(mediaDir, "tiny.mp3"),
join(audioDir, "tiny.mp3"),
]);
// 1s sine wav
run([
@@ -82,7 +84,7 @@ run([
"pcm_s16le",
"-ar",
"8000",
join(mediaDir, "tiny.wav"),
join(audioDir, "tiny.wav"),
]);
// Minimal OOXML/EPUB containers via archiver (resolved from apps/api).
@@ -154,8 +156,8 @@ await writeZip(
// Encrypted PDF fixture derived from test-3page.pdf via qpdf (AES-256).
const qpdf = whichBin("QPDF_PATH", "qpdf");
if (qpdf) {
const srcPdf = join(root, "tests/fixtures/test-3page.pdf");
const encPdf = join(docsDir, "encrypted.pdf");
const srcPdf = join(root, "tests/fixtures/document/valid/test-3page.pdf");
const encPdf = join(root, "tests/fixtures/document/valid/encrypted.pdf");
const qres = spawnSync(qpdf, [srcPdf, "--encrypt", "test123", "owner123", "256", "--", encPdf], {
stdio: "inherit",
});
@@ -192,4 +194,4 @@ A paragraph with **bold** and a list:
`,
);
console.log("Fixtures written to tests/fixtures/media and tests/fixtures/documents");
console.log("Fixtures written to tests/fixtures/{video,audio}/formats and tests/fixtures/document/formats");