整理测试代码并清理文档引用
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const apiGet = vi.fn();
|
||||
const apiPost = vi.fn();
|
||||
const apiDelete = vi.fn();
|
||||
|
||||
vi.mock("./axios", () => ({
|
||||
apiGet,
|
||||
apiPost,
|
||||
apiDelete,
|
||||
}));
|
||||
|
||||
describe("attachments api", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("uses canonical collection URLs with trailing slash", async () => {
|
||||
const { fetchAttachments, uploadAttachment } = await import("./attachments");
|
||||
const file = new File(["x"], "x.txt", { type: "text/plain" });
|
||||
|
||||
fetchAttachments("study-1", "startup_feasibility", "entity-1");
|
||||
uploadAttachment("study-1", "startup_feasibility", "entity-1", file);
|
||||
|
||||
expect(apiGet).toHaveBeenCalledWith("/api/v1/studies/study-1/startup_feasibility/entity-1/attachments/");
|
||||
expect(apiPost).toHaveBeenCalledWith(
|
||||
"/api/v1/studies/study-1/startup_feasibility/entity-1/attachments/",
|
||||
expect.any(FormData),
|
||||
expect.objectContaining({ headers: { "Content-Type": "multipart/form-data" } })
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user