- Filter the QP table to show only participants with QP > 0 or drafted by any team in the league (undrafted 0-QP participants hidden) - Compute global ranks with tie handling across the full field before filtering so displayed rank numbers and the top-8 Points Line remain correct after rows are removed - Fix flaky CI timeouts: world-cup simulator test (100 → 50 iterations), SportsSection userEvent test (explicit 15s timeout) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { render, screen } from "@testing-library/react";
|
|
import { QualifyingPointsStandings } from "~/components/scoring/QualifyingPointsStandings";
|
|
|
|
const scoringRules = {
|
|
pointsFor1st: 100,
|
|
pointsFor2nd: 70,
|
|
pointsFor3rd: 50,
|
|
pointsFor4th: 40,
|
|
pointsFor5th: 25,
|
|
pointsFor6th: 25,
|
|
pointsFor7th: 15,
|
|
pointsFor8th: 15,
|
|
};
|
|
|
|
describe("QualifyingPointsStandings", () => {
|
|
it("renders fractional QP to hundredths", () => {
|
|
render(
|
|
<QualifyingPointsStandings
|
|
standings={[
|
|
{
|
|
id: "standing-1",
|
|
totalQualifyingPoints: "14.67",
|
|
eventsScored: 1,
|
|
finalRanking: null,
|
|
globalRank: 1,
|
|
participant: { id: "participant-1", name: "Player One" },
|
|
},
|
|
{
|
|
id: "standing-2",
|
|
totalQualifyingPoints: "0.50",
|
|
eventsScored: 1,
|
|
finalRanking: null,
|
|
globalRank: 2,
|
|
participant: { id: "participant-2", name: "Player Two" },
|
|
},
|
|
{
|
|
id: "standing-3",
|
|
totalQualifyingPoints: "0.43",
|
|
eventsScored: 1,
|
|
finalRanking: null,
|
|
globalRank: 3,
|
|
participant: { id: "participant-3", name: "Player Three" },
|
|
},
|
|
]}
|
|
scoringRules={scoringRules}
|
|
isFinalized={false}
|
|
totalMajors={4}
|
|
majorsCompleted={1}
|
|
canFinalize={false}
|
|
/>
|
|
);
|
|
|
|
expect(screen.getByText("14.67 QP")).toBeInTheDocument();
|
|
expect(screen.getByText("0.50 QP")).toBeInTheDocument();
|
|
expect(screen.getByText("0.43 QP")).toBeInTheDocument();
|
|
});
|
|
});
|