diff --git a/app/components/__tests__/AvailableParticipantsSection.test.tsx b/app/components/__tests__/AvailableParticipantsSection.test.tsx index a941530..691b9d0 100644 --- a/app/components/__tests__/AvailableParticipantsSection.test.tsx +++ b/app/components/__tests__/AvailableParticipantsSection.test.tsx @@ -1,5 +1,5 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; -import { render, screen, within } from "@testing-library/react"; +import { render, screen, within, fireEvent } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { AvailableParticipantsSection } from "~/components/draft/AvailableParticipantsSection"; import type { DraftIneligibilityReason } from "~/lib/draft-eligibility"; @@ -106,7 +106,7 @@ describe("AvailableParticipantsSection", () => { expect(screen.getByText("Show Drafted")).toBeInTheDocument(); }); - it("renders Show Ineligible and Show drafted sports toggles when hasTeam=true", async () => { + it("renders Show Ineligible and Show drafted sports toggles when hasTeam=true", () => { render( { /> ); expect(screen.getByText("Show Ineligible")).toBeInTheDocument(); - // Show drafted sports lives inside the sport filter dropdown - await clickFirstSportFilterTrigger("Filter by sport: All Sports"); + // Show drafted sports lives inside the sport filter dropdown. + // Use fireEvent instead of user.click to avoid Radix UI timer hang when + // hasTeam=true renders extra Checkbox components that stall userEvent's + // act() settlement loop. + fireEvent.click(screen.getAllByRole("button", { name: "Filter by sport: All Sports" })[0]); const dialog = screen.getByRole("dialog"); expect(within(dialog).getByText("Show drafted sports")).toBeInTheDocument(); });