Fix oxlint failures in qualifying-bracket-scoring test
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 3m5s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m21s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped

- Replace Array#sort() with Array#toSorted() (unicorn/no-array-sort).
- Remove non-null assertions (typescript-eslint/no-non-null-assertion) by
  asserting the returned state objects directly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QVLqaYGXCeSYYqTHZmbRZi
This commit is contained in:
Claude 2026-06-19 00:57:21 +00:00
parent 5dfe39bba2
commit 0046928a66
No known key found for this signature in database

View file

@ -142,7 +142,7 @@ describe("deriveBracketQualifyingStates (simple_8)", () => {
it("is idempotent — same matches yield the same states", () => {
const a = states([...QF_ALL, ...SF_ALL]);
const b = states([...QF_ALL, ...SF_ALL]);
expect([...a.entries()].sort()).toEqual([...b.entries()].sort());
expect([...a.entries()].toSorted()).toEqual([...b.entries()].toSorted());
});
});
@ -163,10 +163,10 @@ describe("guaranteed-minimum QP per outcome (default config)", () => {
it("end-to-end: a QF win immediately yields a 9 QP floor", () => {
const s = states(QF_ALL);
const winner = s.get("t1")!;
expect(qpFor(winner.placement, winner.tieCount)).toBeCloseTo(9);
const loser = s.get("t8")!;
expect(qpFor(loser.placement, loser.tieCount)).toBeCloseTo(4);
expect(s.get("t1")).toEqual({ placement: 3, tieCount: 2 });
expect(qpFor(3, 2)).toBeCloseTo(9);
expect(s.get("t8")).toEqual({ placement: 5, tieCount: 4 });
expect(qpFor(5, 4)).toBeCloseTo(4);
});
});
@ -175,12 +175,11 @@ describe("guaranteed-minimum QP per outcome (default config)", () => {
describe("structural tie span vs. live-count regrouping", () => {
it("4 QF winners share placement 3 but each keeps the 2-slot (9 QP) floor", () => {
const s = states(QF_ALL);
const winners = ["t1", "t2", "t3", "t4"].map((id) => s.get(id)!);
// All four sit at placement 3, but with the STRUCTURAL tie span of 2.
for (const w of winners) {
expect(w).toEqual({ placement: 3, tieCount: 2 });
expect(qpFor(w.placement, w.tieCount)).toBeCloseTo(9);
// All four QF winners sit at placement 3, but with the STRUCTURAL tie span of 2.
for (const id of ["t1", "t2", "t3", "t4"]) {
expect(s.get(id)).toEqual({ placement: 3, tieCount: 2 });
}
expect(qpFor(3, 2)).toBeCloseTo(9);
// A naive regroup by LIVE count (4 rows at placement 3) would average over
// slots 36 and wrongly yield 7 QP — the bug processQualifyingEvent must avoid
// by delegating bracket events to the structural-tieCount path.