From d8e5be45585cdb777d2445c944136f81d2a3378a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 7 May 2026 01:04:08 +0000 Subject: [PATCH] Fix StandingsPreview test ambiguous text query for team names FlagSvg renders a element with the team name for accessibility, so getByText("Team Alpha") matched two elements. Scope the query to the <p> element to target only the visible team name display. https://claude.ai/code/session_01CVt5Vo2PDGY4G3wSWbsmRG --- app/components/league/__tests__/StandingsPreview.test.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/league/__tests__/StandingsPreview.test.tsx b/app/components/league/__tests__/StandingsPreview.test.tsx index d692858..14b7636 100644 --- a/app/components/league/__tests__/StandingsPreview.test.tsx +++ b/app/components/league/__tests__/StandingsPreview.test.tsx @@ -70,8 +70,10 @@ describe("StandingsPreview", () => { ]; renderWithRouter(<StandingsPreview entries={entries} />); - expect(screen.getByText("Team Alpha")).toBeInTheDocument(); - expect(screen.getByText("Team Beta")).toBeInTheDocument(); + // Use selector to target only the <p> element — the team name also appears + // in the SVG <title> for accessibility, causing multiple matches otherwise. + expect(screen.getByText("Team Alpha", { selector: "p" })).toBeInTheDocument(); + expect(screen.getByText("Team Beta", { selector: "p" })).toBeInTheDocument(); }); it("renders owner name below team name", () => {