diff --git a/app/components/scoring/PlayoffBracket.tsx b/app/components/scoring/PlayoffBracket.tsx index 5510ca4..7f12868 100644 --- a/app/components/scoring/PlayoffBracket.tsx +++ b/app/components/scoring/PlayoffBracket.tsx @@ -286,7 +286,7 @@ export function PlayoffBracket({ .map((id) => participantMap.get(id)) .filter((p): p is Participant => p !== undefined) // Owned-by-a-manager players first, then alphabetical by name. - .sort((a, b) => { + .toSorted((a, b) => { const aOwned = ownershipMap.has(a.id); const bOwned = ownershipMap.has(b.id); if (aOwned !== bOwned) return aOwned ? -1 : 1; diff --git a/app/services/__tests__/sync-tournament-results.test.ts b/app/services/__tests__/sync-tournament-results.test.ts index 59092c8..01bebfb 100644 --- a/app/services/__tests__/sync-tournament-results.test.ts +++ b/app/services/__tests__/sync-tournament-results.test.ts @@ -1,5 +1,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; +import type { Mock } from "vitest"; import type * as DrizzleOrm from "drizzle-orm"; +import type * as ScoringCalculatorModule from "~/models/scoring-calculator"; vi.mock("~/database/context", () => ({ database: vi.fn(), @@ -10,7 +12,7 @@ vi.mock("~/models/scoring-calculator", async () => { // to processQualifyingEvent reflects the mock canonical results AND the bracket's // structural tie span (deriveBracketQualifyingStates / getRoundConfig). Only the // DB-touching orchestrators are stubbed. - const actual = await vi.importActual( + const actual = await vi.importActual( "~/models/scoring-calculator" ); return { @@ -975,11 +977,12 @@ describe("syncMajorFromPrimaryEvent", () => { ).toHaveLength(4); // The mirror window was scored with the STRUCTURAL span, not the row count. - const mirrorCall = vi - .mocked(processQualifyingEvent) - .mock.calls.find((c) => c[0] === "ev-MIRROR"); + const mirrorCall = (processQualifyingEvent as Mock).mock.calls.find( + (c) => c[0] === "ev-MIRROR" + ); expect(mirrorCall).toBeDefined(); - const tieMap = mirrorCall![2]!.canonicalTieCountByPlacement as Map; + if (!mirrorCall) return; + const tieMap = mirrorCall[2].canonicalTieCountByPlacement as Map; 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 });