brackt/app/components/__tests__/QualifyingPointsStandings.test.tsx

59 lines
1.6 KiB
TypeScript
Raw Normal View History

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();
});
});