mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -12,6 +12,7 @@
|
||||
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { apiToolPath } from "@snapotter/shared";
|
||||
|
||||
// ── Config ────────────────────────────────────────────────────────
|
||||
const BASE = "http://localhost:13499";
|
||||
@@ -530,7 +531,7 @@ async function main() {
|
||||
|
||||
let res: Response;
|
||||
try {
|
||||
res = await fetch(`${BASE}/api/v1/tools/${tool.id}`, {
|
||||
res = await fetch(`${BASE}${apiToolPath(tool.id)}`, {
|
||||
method: "POST",
|
||||
body: form,
|
||||
signal: controller.signal,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user