fix(tests): section-prefix tool API URLs across overhauled suite

#276's overhauled integration tests + QA sweep scripts hit the old
sectionless /api/v1/tools/<id> routes, which 404 after #280 made routes
section-prefixed. Ran scripts/rewrite-tool-paths.ts for literal URLs and
converted dynamic /api/v1/tools/${id} constructions to apiToolPath().
Negative-test paths (nonexistent/fake tools) intentionally left raw.
This commit is contained in:
SnapOtter
2026-06-21 02:30:58 +08:00
parent 5ffa1d55ea
commit d4dc2eae5d
10 changed files with 187 additions and 180 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
import { execFileSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import { apiToolPath } from "@snapotter/shared";
const BASE = "http://localhost:13499";
@@ -63,7 +64,7 @@ async function run(toolId: string, file: string, settings: Record<string, unknow
const fd = new FormData();
fd.append("file", new Blob([buf]), path.basename(file));
fd.append("settings", JSON.stringify(settings));
const res = await fetch(`${BASE}/api/v1/tools/${toolId}`, { method: "POST", body: fd });
const res = await fetch(`${BASE}${apiToolPath(toolId)}`, { method: "POST", body: fd });
if (res.status === 200) {
const j = (await res.json()) as { downloadUrl?: string };
if (j.downloadUrl) {