| 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"); | |
| }); | |
| }); | |