Fix lint in new QP change-detection tests
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 3m0s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m17s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped

Replace inline import() type annotations with top-level `import type * as`
(consistent-type-imports) and use toSorted() over sort() (unicorn/no-array-sort)
in the tests added for diffChangedQualifyingPoints.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hq3fG4Zn3unntbSQAGSqCq
This commit is contained in:
Claude 2026-07-01 22:04:29 +00:00
parent 21c6fd6229
commit 9fda6310bc
No known key found for this signature in database
3 changed files with 6 additions and 4 deletions

View file

@ -19,7 +19,7 @@ describe("diffChangedQualifyingPoints", () => {
{ id: "C", qp: "3.00" }, // first-time score
];
expect([...diffChangedQualifyingPoints(before, after)].sort()).toEqual(["B", "C"]);
expect([...diffChangedQualifyingPoints(before, after)].toSorted()).toEqual(["B", "C"]);
});
it("normalizes decimal formatting so 10 and 10.00 are equal", () => {

View file

@ -1,4 +1,5 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import type * as QualifyingPointsModule from "~/models/qualifying-points";
// Spy on the QP Discord notification, and no-op the per-participant total recalc
// (its own eventResults query would otherwise interfere with the before/after
@ -8,7 +9,7 @@ vi.mock("~/services/qualifying-points-discord.server", () => ({
}));
vi.mock("~/models/qualifying-points", async (importActual) => {
const actual = await importActual<typeof import("~/models/qualifying-points")>();
const actual = await importActual<typeof QualifyingPointsModule>();
return {
...actual,
recalculateParticipantQP: vi.fn().mockResolvedValue({ totalQP: 0, eventsScored: 0 }),

View file

@ -1,4 +1,5 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import type * as QualifyingPointsModule from "~/models/qualifying-points";
// The helper under test re-derives QP via processQualifyingBracketEvent and
// recalculates dropped participants — both stubbed so the test drives the
@ -13,7 +14,7 @@ vi.mock("~/models/scoring-calculator", () => ({
// Keep the real diffChangedQualifyingPoints (the change-detection primitive under
// test here); only stub the dropped-participant total recalc.
vi.mock("~/models/qualifying-points", async (importActual) => {
const actual = await importActual<typeof import("~/models/qualifying-points")>();
const actual = await importActual<typeof QualifyingPointsModule>();
return {
...actual,
recalculateParticipantQP: vi.fn().mockResolvedValue(undefined),
@ -69,7 +70,7 @@ describe("rescoreTennisBracketAndDetectChanges", () => {
const changed = await rescoreTennisBracketAndDetectChanges(EVENT_ID, SPORTS_SEASON_ID, db as never);
expect([...changed].sort()).toEqual(["B", "C"]);
expect([...changed].toSorted()).toEqual(["B", "C"]);
expect(processQualifyingBracketEvent).toHaveBeenCalledWith(EVENT_ID, db);
// No participant dropped out, so no manual total recalc.
expect(recalculateParticipantQP).not.toHaveBeenCalled();