Found by the manual e2e of the production build: - paste guests preview counted an array, so it read "[object Object]" and never offered Save guests; - New event and Add user errors now clear when the field is fixed; - "Send to all unsent" says when nothing was unsent; - the check-in lookup shows an error on an empty submit and carries the typed email or mobile into the walk-in form; - invitation emails sent over Pub/Sub now save their recipient's link, so the Emails page shows the recipient. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { describe, it, expect, vi } from "vitest";
|
|
import { render, screen } from "@testing-library/react";
|
|
import userEvent from "@testing-library/user-event";
|
|
|
|
const mocks = vi.hoisted(() => ({
|
|
listGuests: vi.fn(),
|
|
addGuests: vi.fn(),
|
|
removeGuest: vi.fn(),
|
|
sendInvites: vi.fn(),
|
|
getAttendance: vi.fn(),
|
|
useAdminAuth: vi.fn(),
|
|
}));
|
|
vi.mock("@/app/lib/services/adminGuests", () => mocks);
|
|
vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: mocks.useAdminAuth }));
|
|
|
|
import { GuestsCard } from "./GuestsCard";
|
|
|
|
describe("GuestsCard send to all unsent", () => {
|
|
it("says so when nothing was sent or skipped", async () => {
|
|
mocks.listGuests.mockResolvedValue([]);
|
|
mocks.getAttendance.mockResolvedValue({});
|
|
mocks.sendInvites.mockResolvedValue({ sent: 0, skippedNoEmail: 0 });
|
|
mocks.useAdminAuth.mockReturnValue({ loading: false, hasModule: () => true });
|
|
render(<GuestsCard eventUuid="u1" />);
|
|
await userEvent.click(await screen.findByRole("button", { name: "Send to all unsent" }));
|
|
expect(await screen.findByRole("status")).toHaveTextContent("No unsent invitations");
|
|
});
|
|
});
|