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 <noreply@anthropic.com>
This commit is contained in:
Chris Parsons 2026-05-12 10:34:15 -07:00
parent ed57c67b93
commit 3e2653b556

View file

@ -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(
<RegularSeasonStandings
standings={[
@ -198,9 +199,6 @@ describe("RegularSeasonStandings", () => {
// Conference group headings are rendered as <h3>
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");
});