test(po-attachments): use NextRequest instead of any cast

This commit is contained in:
SJCoetz 2026-07-09 23:20:10 +02:00
parent 1477265db9
commit 9bc9d389ce

View file

@ -1,4 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { NextRequest } from "next/server";
const getOneMock = vi.fn();
const updateMock = vi.fn();
@ -32,10 +33,10 @@ describe("DELETE /api/v1/purchase-orders/[id]/attachments/[filename]", () => {
updateMock.mockResolvedValueOnce({});
const res = await DELETE(
new Request(
new NextRequest(
"http://localhost/api/v1/purchase-orders/po-1/attachments/delete-me.pdf",
{ method: "DELETE" },
) as any,
),
{ params: Promise.resolve({ id: "po-1", filename: "delete-me.pdf" }) },
);
@ -53,10 +54,10 @@ describe("DELETE /api/v1/purchase-orders/[id]/attachments/[filename]", () => {
});
const res = await DELETE(
new Request(
new NextRequest(
"http://localhost/api/v1/purchase-orders/po-1/attachments/other.pdf",
{ method: "DELETE" },
) as any,
),
{ params: Promise.resolve({ id: "po-1", filename: "other.pdf" }) },
);