917ab7ccf1
Add early termination visit workflow with ordering, non-applicable visit handling, visit window display, and medication adherence support. Extend monitoring visit issue template fields, site scoping, setup draft project info handling, login security UI, attachment behavior, and related tests/migrations.
33 lines
1021 B
TypeScript
33 lines
1021 B
TypeScript
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" } })
|
|
);
|
|
});
|
|
});
|