From 52277ab8645fd928b19501c7fb3c8e199903a2cc Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 9 Jun 2026 21:48:43 +0000 Subject: [PATCH] Fix AvailableParticipantsSection test: use fireEvent to avoid Radix UI timer hang Replace async userEvent.click with fireEvent.click for the sport filter dropdown test when hasTeam=true. The extra Checkbox components rendered in that path stall userEvent's act() settlement loop inside Radix UI, causing the test to hang. fireEvent bypasses the async machinery while still exercising the open/close behavior. https://claude.ai/code/session_012ACmUs2vAwEF9jZu7Guos2 --- .../__tests__/AvailableParticipantsSection.test.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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(); });