Fix oxlint violations in CS Major simulator

- Replace non-null assertion (!) with null-safe guard in simulateOneMajor
- Replace non-null assertions in test expectations with nullish coalescing
- Move makeStage3QPConfig out of describe block (no captured variables)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chris Parsons 2026-04-07 21:20:15 +00:00
parent 712ac70328
commit a99b67059a
2 changed files with 15 additions and 11 deletions

View file

@ -319,9 +319,8 @@ describe("simulateChampionsStage", () => {
// ─── calcStage3ExitQP ─────────────────────────────────────────────────────────
describe("calcStage3ExitQP", () => {
function makeStage3QPConfig(): Map<number, number> {
// Placements 916 with descending QP: 9→80, 10→70, ..., 16→10
function makeStage3QPConfig(): Map<number, number> {
const config = new Map<number, number>();
for (let i = 9; i <= 16; i++) {
config.set(i, (17 - i) * 10);
@ -329,6 +328,7 @@ describe("calcStage3ExitQP", () => {
return config;
}
describe("calcStage3ExitQP", () => {
it("returns empty map for empty input", () => {
const result = calcStage3ExitQP([], new Map());
expect(result.size).toBe(0);
@ -376,8 +376,11 @@ describe("calcStage3ExitQP", () => {
const config = makeStage3QPConfig();
const result = calcStage3ExitQP(elim, config);
expect(result.get("high")!).toBeGreaterThan(result.get("mid")!);
expect(result.get("mid")!).toBeGreaterThan(result.get("low")!);
const highQP = result.get("high") ?? 0;
const midQP = result.get("mid") ?? 0;
const lowQP = result.get("low") ?? 0;
expect(highQP).toBeGreaterThan(midQP);
expect(midQP).toBeGreaterThan(lowQP);
});
});

View file

@ -736,7 +736,8 @@ export function simulateOneMajor(
const byPlacement = new Map<number, string[]>();
for (const [pid, placement] of champResult.placements) {
if (!byPlacement.has(placement)) byPlacement.set(placement, []);
byPlacement.get(placement)!.push(pid);
const group = byPlacement.get(placement);
if (group) group.push(pid);
}
for (const [placement, pids] of byPlacement) {
const slots = Array.from({ length: pids.length }, (_, i) => placement + i);