From 3e2653b556d26895c203dd30dea020836e63d7f2 Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Tue, 12 May 2026 10:34:15 -0700 Subject: [PATCH] Fix RegularSeasonStandings tests broken by showStats toggle - STK/streak tests: click the Details switch before asserting on stats columns, which are now hidden behind the toggle by default - Ownership badge test: use getAllByText since the badge renders in both the mobile inline slot and the hidden-sm desktop Mgr cell - Division label test: remove expectation for inline per-row division labels, which were intentionally removed to fix mobile scroll Co-Authored-By: Claude Sonnet 4.6 --- .../__tests__/RegularSeasonStandings.test.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/components/sport-season/__tests__/RegularSeasonStandings.test.tsx b/app/components/sport-season/__tests__/RegularSeasonStandings.test.tsx index 3911fd7..9e8cee1 100644 --- a/app/components/sport-season/__tests__/RegularSeasonStandings.test.tsx +++ b/app/components/sport-season/__tests__/RegularSeasonStandings.test.tsx @@ -1,5 +1,5 @@ import { describe, it, expect } from "vitest"; -import { render, screen } from "@testing-library/react"; +import { render, screen, fireEvent } from "@testing-library/react"; import { RegularSeasonStandings } from "../RegularSeasonStandings"; function makeRow(overrides: Partial<{ @@ -128,6 +128,7 @@ describe("RegularSeasonStandings", () => { userParticipantIds={NO_USER_IDS} /> ); + fireEvent.click(screen.getByRole("switch")); expect(screen.getByText("STK")).toBeInTheDocument(); }); @@ -184,7 +185,7 @@ describe("RegularSeasonStandings", () => { expect(screen.getByText("69")).toBeInTheDocument(); }); - it("renders conference headings and inline division labels when present", () => { + it("renders conference headings when standings have conference data", () => { render( { // Conference group headings are rendered as

expect(screen.getByText(/Eastern Conference/i)).toBeInTheDocument(); expect(screen.getByText(/Western Conference/i)).toBeInTheDocument(); - // Division is now shown as an inline label per row (not a section header) - expect(screen.getAllByText(/Atlantic/i).length).toBeGreaterThan(0); - expect(screen.getAllByText(/Pacific/i).length).toBeGreaterThan(0); }); it("shows ownership badge for drafted teams", () => { @@ -213,7 +211,8 @@ describe("RegularSeasonStandings", () => { userParticipantIds={NO_USER_IDS} /> ); - expect(screen.getByText("Alice")).toBeInTheDocument(); + // Owner name appears in both the mobile inline badge and the desktop Mgr column + expect(screen.getAllByText("Alice").length).toBeGreaterThan(0); }); it("does not show badge for undrafted teams", () => { @@ -249,6 +248,7 @@ describe("RegularSeasonStandings", () => { userParticipantIds={NO_USER_IDS} /> ); + fireEvent.click(screen.getByRole("switch")); const streakEl = screen.getByText("W5"); expect(streakEl.className).toContain("emerald"); }); @@ -261,6 +261,7 @@ describe("RegularSeasonStandings", () => { userParticipantIds={NO_USER_IDS} /> ); + fireEvent.click(screen.getByRole("switch")); const streakEl = screen.getByText("L3"); expect(streakEl.className).toContain("destructive"); });