mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -89,21 +89,23 @@ async function run(toolId: string, file: string, settings: Record<string, unknow
|
||||
return { status: res.status, body: (await res.text()).slice(0, 200) };
|
||||
}
|
||||
|
||||
const C = "tests/fixtures/content";
|
||||
const IMG = "tests/fixtures/image/valid";
|
||||
const AUD = "tests/fixtures/audio/valid";
|
||||
const DOC = "tests/fixtures/document/valid";
|
||||
|
||||
const t = await run("transcribe-audio", `${C}/speech-10s.wav`, { outputFormat: "txt" });
|
||||
const t = await run("transcribe-audio", `${AUD}/speech-10s.wav`, { outputFormat: "txt" });
|
||||
console.log(
|
||||
"TRANSCRIBE:",
|
||||
t.out ? `text="${t.out.toString("utf8").slice(0, 200)}"` : JSON.stringify(t).slice(0, 300),
|
||||
);
|
||||
|
||||
const o = await run("ocr", `${C}/ocr-clean.png`, {});
|
||||
const o = await run("ocr", `${IMG}/ocr-clean.png`, {});
|
||||
console.log(
|
||||
"OCR:",
|
||||
o.out ? `text="${o.out.toString("utf8").slice(0, 200)}"` : JSON.stringify(o).slice(0, 300),
|
||||
);
|
||||
|
||||
const r = await run("remove-background", `${C}/portrait-color.jpg`, { outputFormat: "png" });
|
||||
const r = await run("remove-background", `${IMG}/portrait-color.jpg`, { outputFormat: "png" });
|
||||
if (r.out) {
|
||||
fs.writeFileSync("/tmp/rembg-out.png", r.out);
|
||||
let probe = "";
|
||||
@@ -122,14 +124,14 @@ if (r.out) {
|
||||
}
|
||||
|
||||
// F9: ocr-pdf must not segfault and should return text
|
||||
const op = await run("ocr-pdf", `${C}/ocr-scanned.pdf`, {});
|
||||
const op = await run("ocr-pdf", `${DOC}/ocr-scanned.pdf`, {});
|
||||
console.log(
|
||||
"OCR-PDF:",
|
||||
op.out ? `out="${op.out.toString("utf8").slice(0, 160)}"` : JSON.stringify(op).slice(0, 300),
|
||||
);
|
||||
|
||||
// F11: RAW processing must work (resize a .cr2 from the formats fixtures)
|
||||
const raw = await run("resize", "tests/fixtures/formats/sample.cr2", { width: 80 });
|
||||
const raw = await run("resize", "tests/fixtures/image/formats/sample.cr2", { width: 80 });
|
||||
console.log(
|
||||
"RAW-RESIZE(cr2):",
|
||||
raw.out ? `bytes=${raw.out.length}` : JSON.stringify(raw).slice(0, 300),
|
||||
|
||||
Reference in New Issue
Block a user