-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "losses against" tiebreaker calculation with dropped teams Closes #…
- Loading branch information
Showing
3 changed files
with
15,113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { Tournament } from "./Tournament"; | ||
import { LOW_INK_DECEMBER_2024 } from "./tests/mocks-li"; | ||
import invariant from "../../../utils/invariant"; | ||
|
||
const TEAM_ERROR_404_ID = 17354; | ||
const TEAM_THIS_IS_FINE_ID = 17513; | ||
|
||
describe("swiss standings", () => { | ||
it("should calculate losses against tied", () => { | ||
const tournament = new Tournament({ | ||
...LOW_INK_DECEMBER_2024(), | ||
simulateBrackets: false, | ||
}); | ||
|
||
const standing = tournament | ||
.bracketByIdx(0) | ||
?.currentStandings(false) | ||
.find((standing) => standing.team.id === TEAM_THIS_IS_FINE_ID); | ||
|
||
invariant(standing, "Standing not found"); | ||
|
||
expect(standing.stats?.lossesAgainstTied).toBe(1); | ||
}); | ||
|
||
it("should ignore early dropped out teams for standings (losses against tied)", () => { | ||
const tournament = new Tournament({ | ||
...LOW_INK_DECEMBER_2024(), | ||
simulateBrackets: false, | ||
}); | ||
|
||
const standing = tournament | ||
.bracketByIdx(0) | ||
?.currentStandings(false) | ||
.find((standing) => standing.team.id === TEAM_ERROR_404_ID); | ||
invariant(standing, "Standing not found"); | ||
|
||
expect(standing.stats?.lossesAgainstTied).toBe(0); // they lost against "Tidy Tidings" but that team dropped out before final round | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.