claude/discord-qp-notifications-75wa7k #122

Merged
chrisp merged 4 commits from claude/discord-qp-notifications-75wa7k into main 2026-07-01 22:14:52 +00:00
3 changed files with 6 additions and 4 deletions
Showing only changes of commit 9fda6310bc - Show all commits

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();