diff --git a/app/models/__tests__/cs2-major-stage.test.ts b/app/models/__tests__/cs2-major-stage.test.ts index 2fd6e84..79ff652 100644 --- a/app/models/__tests__/cs2-major-stage.test.ts +++ b/app/models/__tests__/cs2-major-stage.test.ts @@ -308,7 +308,7 @@ describe("resetCs2Event", () => { const recalcCalls = vi.mocked(recalculateParticipantQP).mock.calls; expect(recalcCalls).toHaveLength(2); - expect(recalcCalls.map((c) => c[0]).sort()).toEqual(["p1", "p2"]); + expect(recalcCalls.map((c) => c[0]).toSorted()).toEqual(["p1", "p2"]); for (const call of recalcCalls) expect(call[1]).toBe("season-1"); }); diff --git a/app/models/simulator.ts b/app/models/simulator.ts index 3455a72..3f35f87 100644 --- a/app/models/simulator.ts +++ b/app/models/simulator.ts @@ -675,7 +675,7 @@ export async function listSportsSeasonSimulatorSummaries(): Promise { expect(oddsOnly.get("longshot")?.method).toBe("sourceOdds"); // Between: a blend that sits strictly between the base and the odds-derived Elo. - const oddsElo = oddsOnly.get("favorite")!.sourceElo; + const oddsElo = oddsOnly.get("favorite")?.sourceElo ?? 0; const blended = resolveSourceElos(inputs, profile, { inputPolicy: { oddsWeight: 0.5 } }); expect(blended.get("favorite")?.method).toBe("blend"); - const blendedElo = blended.get("favorite")!.sourceElo; + const blendedElo = blended.get("favorite")?.sourceElo ?? 0; expect(blendedElo).toBeGreaterThan(Math.min(1800, oddsElo)); expect(blendedElo).toBeLessThan(Math.max(1800, oddsElo)); expect(blendedElo).toBeCloseTo(Math.round(0.5 * 1800 + 0.5 * oddsElo), 0); diff --git a/app/services/simulations/__tests__/runner.test.ts b/app/services/simulations/__tests__/runner.test.ts index f7eb9be..0c4f9b4 100644 --- a/app/services/simulations/__tests__/runner.test.ts +++ b/app/services/simulations/__tests__/runner.test.ts @@ -1,4 +1,5 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; +import type * as SimulationsRegistry from "~/services/simulations/registry"; vi.mock("~/models/sports-season", () => ({ findSportsSeasonById: vi.fn(), @@ -24,7 +25,7 @@ vi.mock("~/models/scoring-calculator", () => ({ vi.mock("~/services/simulations/registry", async (importOriginal) => { // Keep the real SIMULATOR_TYPES / getSimulatorInfo so the manifest (pulled in // transitively via input-policy) can build; only stub getSimulator. - const actual = await importOriginal(); + const actual = await importOriginal(); return { ...actual, getSimulator: vi.fn() }; }); vi.mock("~/services/simulations/simulation-probabilities", () => ({