Fix lint: replace non-null assertions with null-safe alternatives in NHL test

https://claude.ai/code/session_01139GJVg2gqgDjcUzqhnBNn
This commit is contained in:
Claude 2026-04-30 06:13:21 +00:00
parent e7a823fa84
commit 85fc2b2176
No known key found for this signature in database

View file

@ -328,7 +328,8 @@ describe("NHLSimulator — bracket-aware mode", () => {
it("throws if an R1 participant slot is missing", async () => {
const matches = buildFullNHLBracket();
const r1m3 = matches.find((m) => m.round === "Wild Card" && m.matchNumber === 3)!;
const r1m3 = matches.find((m) => m.round === "Wild Card" && m.matchNumber === 3);
if (!r1m3) throw new Error("R1 M3 not found in test fixture");
r1m3.participant2Id = null;
mockDb.query.playoffMatches.findMany.mockResolvedValue(matches);
@ -387,7 +388,7 @@ describe("NHLSimulator — bracket-aware mode", () => {
m.loserId = m.participant2Id;
m.isComplete = true;
}
const r1Winners = r1.map((m) => m.winnerId!);
const r1Winners = r1.map((m) => m.winnerId ?? "");
// R2: fill from R1 winners, p1 always wins
const r2 = matches.filter((m) => m.round === "Divisional");
@ -398,7 +399,7 @@ describe("NHLSimulator — bracket-aware mode", () => {
r2[i].loserId = r2[i].participant2Id;
r2[i].isComplete = true;
}
const r2Winners = r2.map((m) => m.winnerId!);
const r2Winners = r2.map((m) => m.winnerId ?? "");
// R3: fill from R2 winners, p1 always wins
const r3 = matches.filter((m) => m.round === "Conference Finals");
@ -409,11 +410,12 @@ describe("NHLSimulator — bracket-aware mode", () => {
r3[i].loserId = r3[i].participant2Id;
r3[i].isComplete = true;
}
const r3Winners = r3.map((m) => m.winnerId!);
const r3Winners = r3.map((m) => m.winnerId ?? "");
// Final: t[0] vs t[1], t[0] wins
const champion = t[0];
const final = matches.find((m) => m.round === "Stanley Cup")!;
const final = matches.find((m) => m.round === "Stanley Cup");
if (!final) throw new Error("Stanley Cup match not found in test fixture");
final.participant1Id = r3Winners[0];
final.participant2Id = r3Winners[1];
final.winnerId = champion;