Fix lint errors in PlayoffBracket and sync-tournament-results test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
12c165a481
commit
698c6a6509
2 changed files with 9 additions and 6 deletions
|
|
@ -286,7 +286,7 @@ export function PlayoffBracket({
|
||||||
.map((id) => participantMap.get(id))
|
.map((id) => participantMap.get(id))
|
||||||
.filter((p): p is Participant => p !== undefined)
|
.filter((p): p is Participant => p !== undefined)
|
||||||
// Owned-by-a-manager players first, then alphabetical by name.
|
// Owned-by-a-manager players first, then alphabetical by name.
|
||||||
.sort((a, b) => {
|
.toSorted((a, b) => {
|
||||||
const aOwned = ownershipMap.has(a.id);
|
const aOwned = ownershipMap.has(a.id);
|
||||||
const bOwned = ownershipMap.has(b.id);
|
const bOwned = ownershipMap.has(b.id);
|
||||||
if (aOwned !== bOwned) return aOwned ? -1 : 1;
|
if (aOwned !== bOwned) return aOwned ? -1 : 1;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||||
|
import type { Mock } from "vitest";
|
||||||
import type * as DrizzleOrm from "drizzle-orm";
|
import type * as DrizzleOrm from "drizzle-orm";
|
||||||
|
import type * as ScoringCalculatorModule from "~/models/scoring-calculator";
|
||||||
|
|
||||||
vi.mock("~/database/context", () => ({
|
vi.mock("~/database/context", () => ({
|
||||||
database: vi.fn(),
|
database: vi.fn(),
|
||||||
|
|
@ -10,7 +12,7 @@ vi.mock("~/models/scoring-calculator", async () => {
|
||||||
// to processQualifyingEvent reflects the mock canonical results AND the bracket's
|
// to processQualifyingEvent reflects the mock canonical results AND the bracket's
|
||||||
// structural tie span (deriveBracketQualifyingStates / getRoundConfig). Only the
|
// structural tie span (deriveBracketQualifyingStates / getRoundConfig). Only the
|
||||||
// DB-touching orchestrators are stubbed.
|
// DB-touching orchestrators are stubbed.
|
||||||
const actual = await vi.importActual<typeof import("~/models/scoring-calculator")>(
|
const actual = await vi.importActual<typeof ScoringCalculatorModule>(
|
||||||
"~/models/scoring-calculator"
|
"~/models/scoring-calculator"
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
|
|
@ -975,11 +977,12 @@ describe("syncMajorFromPrimaryEvent", () => {
|
||||||
).toHaveLength(4);
|
).toHaveLength(4);
|
||||||
|
|
||||||
// The mirror window was scored with the STRUCTURAL span, not the row count.
|
// The mirror window was scored with the STRUCTURAL span, not the row count.
|
||||||
const mirrorCall = vi
|
const mirrorCall = (processQualifyingEvent as Mock).mock.calls.find(
|
||||||
.mocked(processQualifyingEvent)
|
(c) => c[0] === "ev-MIRROR"
|
||||||
.mock.calls.find((c) => c[0] === "ev-MIRROR");
|
);
|
||||||
expect(mirrorCall).toBeDefined();
|
expect(mirrorCall).toBeDefined();
|
||||||
const tieMap = mirrorCall![2]!.canonicalTieCountByPlacement as Map<number, number>;
|
if (!mirrorCall) return;
|
||||||
|
const tieMap = mirrorCall[2].canonicalTieCountByPlacement as Map<number, number>;
|
||||||
expect(tieMap.get(9)).toBe(8); // R16 tier spans 8, not the 4 rows currently there
|
expect(tieMap.get(9)).toBe(8); // R16 tier spans 8, not the 4 rows currently there
|
||||||
expect(tieMap.get(5)).toBe(4); // QF tier spans 4
|
expect(tieMap.get(5)).toBe(4); // QF tier spans 4
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue