Fix oxlint errors in simulator and test files
- Replace non-null assertions with optional chaining + nullish coalescing in input-policy.test.ts - Remove useless empty fallback in spread in simulator.ts - Replace inline import() type annotation with top-level import type in runner.test.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPrEA7jt8Y47Cewq22gMyv
This commit is contained in:
parent
ee099c64cd
commit
6156b8e36f
3 changed files with 5 additions and 4 deletions
|
|
@ -675,7 +675,7 @@ export async function listSportsSeasonSimulatorSummaries(): Promise<SportsSeason
|
|||
const simulatorType = (season.simulatorConfig?.simulatorType ?? season.sport.simulatorType) as SimulatorType;
|
||||
const profile = await getSimulatorProfile(simulatorType);
|
||||
const readiness = await validateSimulatorReadiness(season.id);
|
||||
const mergedConfig = { ...profile.defaultConfig, ...(season.simulatorConfig?.config ?? {}) };
|
||||
const mergedConfig = { ...profile.defaultConfig, ...season.simulatorConfig?.config };
|
||||
const policy = getSimulatorInputPolicy(mergedConfig);
|
||||
return {
|
||||
sportsSeasonId: season.id,
|
||||
|
|
|
|||
|
|
@ -221,10 +221,10 @@ describe("simulator input policy", () => {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -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<typeof import("~/services/simulations/registry")>();
|
||||
const actual = await importOriginal<SimulationsRegistry>();
|
||||
return { ...actual, getSimulator: vi.fn() };
|
||||
});
|
||||
vi.mock("~/services/simulations/simulation-probabilities", () => ({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue