Fix leaked mockReturnValueOnce in scored-match test

The new test only triggers one selectDistinct call (rows is empty so the
max-game-number lookup is skipped). The second mockReturnValueOnce was
never consumed, leaving a makeMaxGameChain value in the queue that was
then picked up by the subsequent "uses leftJoin" test, causing it to fail
with "leftJoin is not a function".

https://claude.ai/code/session_01GMLmjN9mwoANfpgSciD7Bi
This commit is contained in:
Claude 2026-03-31 17:04:22 +00:00
parent 700f1e8739
commit 761cda9cfc
No known key found for this signature in database

View file

@ -573,10 +573,10 @@ describe("getUpcomingEventsForDraftedParticipants — bracket misc", () => {
// The DB mock returns rows only for matches the WHERE clause matches. // The DB mock returns rows only for matches the WHERE clause matches.
// When a match is complete (isComplete=true) the DB should return no rows. // When a match is complete (isComplete=true) the DB should return no rows.
// Simulate this by returning an empty result set. // Simulate this by returning an empty result set.
// No second mockReturnValueOnce is needed: empty rows means eventIdsFromRows
// is empty so the max-game-number lookup is never called.
const chain = makeSelectChain([]); const chain = makeSelectChain([]);
mockDb.selectDistinct mockDb.selectDistinct.mockReturnValueOnce(chain);
.mockReturnValueOnce(chain)
.mockReturnValueOnce(makeMaxGameChain([]));
const result = await getUpcomingEventsForDraftedParticipants( const result = await getUpcomingEventsForDraftedParticipants(
SPORTS_SEASON_ID, "playoff_bracket", SPORTS_SEASON_ID, "playoff_bracket",