sync racing standings #80

Merged
chrisp merged 6 commits from claude/gallant-bell-cuzqgx into main 2026-06-10 04:25:49 +00:00
Showing only changes of commit 52277ab864 - Show all commits

View file

@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from "vitest"; 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 userEvent from "@testing-library/user-event";
import { AvailableParticipantsSection } from "~/components/draft/AvailableParticipantsSection"; import { AvailableParticipantsSection } from "~/components/draft/AvailableParticipantsSection";
import type { DraftIneligibilityReason } from "~/lib/draft-eligibility"; import type { DraftIneligibilityReason } from "~/lib/draft-eligibility";
@ -106,7 +106,7 @@ describe("AvailableParticipantsSection", () => {
expect(screen.getByText("Show Drafted")).toBeInTheDocument(); 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( render(
<AvailableParticipantsSection <AvailableParticipantsSection
{...defaultProps} {...defaultProps}
@ -115,8 +115,11 @@ describe("AvailableParticipantsSection", () => {
/> />
); );
expect(screen.getByText("Show Ineligible")).toBeInTheDocument(); expect(screen.getByText("Show Ineligible")).toBeInTheDocument();
// Show drafted sports lives inside the sport filter dropdown // Show drafted sports lives inside the sport filter dropdown.
await clickFirstSportFilterTrigger("Filter by sport: All Sports"); // 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"); const dialog = screen.getByRole("dialog");
expect(within(dialog).getByText("Show drafted sports")).toBeInTheDocument(); expect(within(dialog).getByText("Show drafted sports")).toBeInTheDocument();
}); });