import { describe, it, expect, vi, beforeEach } from "vitest"; import { render, screen, fireEvent } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { WorkspaceMemberRole } from "@mosaic/shared"; import { InviteMember } from "./InviteMember"; /** * Helper to get the invite form element from the rendered component. * The form wraps the submit button, so we locate it via the button. */ function getForm(): HTMLFormElement { const button = screen.getByRole("button", { name: /send invitation/i }); const form = button.closest("form"); if (!form) { throw new Error("Could not locate