import { describe, it, expect, vi } from "vitest"; const mocks = vi.hoisted(() => ({ apiGet: vi.fn(), apiPost: vi.fn(), apiDelete: vi.fn() })); vi.mock("@/app/lib/clientApi", () => mocks); import { addGuests } from "./adminGuests"; describe("addGuests result", () => { it("turns the API's added guest list into a count", async () => { // The mobile-api returns the added guests themselves, not a number. mocks.apiPost.mockResolvedValue({ added: [{ name: "A" }, { name: "B" }], rejected: [] }); expect(await addGuests("e1", [], true)).toEqual({ added: 2, rejected: [] }); }); });