tenderhub-webai-verification / apps /web /src /__tests__ /api /uploads-init.test.ts
engresearch's picture
Upload folder using huggingface_hub
7f88bdf verified
import { POST as initUpload } from "../../app/api/uploads/init/route";
describe("Uploads API", () => {
it("returns 400 for invalid payload", async () => {
// Construct a standard Fetch Request as expected by App Router
const req = new Request("http://localhost/api/uploads/init", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({}),
});
const res = await initUpload(req);
expect(res.status).toBe(400);
const data = await res.json();
expect(data.error).toBe("Invalid upload init payload");
});
});