fix: make competition reversals replayable

This commit is contained in:
dahyeon committed 2026-07-12 19:47:34 +00:00
1 parent 4d6fa2625e
commit ce07bfa0c8
6 files changed
+169 -13

No files matched your search

@@ -253,6 +253,59 @@ describe('projectCompetition', () => {
]),
);
});
it('makes a voided GameSlot ready again when its Series can be replayed', () => {
const competitionId = 'competition-replay-voided-slot';
const teams = [seededTeam('team-1', 1), seededTeam('team-2', 2)];
const format = {
type: 'paired-series' as const,
rule: fixedGames(1),
};
const seriesGraph = generateSeriesGraph({
competitionId,
teams,
format,
});
const definition = seriesGraph[0];
const accepted = acceptedGameFactory(competitionId)(
definition,
1,
'team-1',
'team-2',
'team-1',
);
const projection = projectCompetition({
competitionId,
revision: 2,
projectorVersion: 1,
teams,
format,
seriesGraph,
facts: [
accepted,
{
id: 'fact-void-game-1',
type: 'game-voided',
competitionId,
revision: 2,
ordinalWithinRevision: 1,
commandId: 'command-void-game-1',
schemaVersion: 1,
actor: { type: 'user' as const },
occurredAt: new Date('2026-07-12T00:00:02.000Z'),
recordedAt: new Date('2026-07-12T00:01:02.000Z'),
gameAcceptedFactId: accepted.id,
reason: 'Incorrect Riot evidence',
},
],
});
expect(projection.phase).toBe('ready');
expect(projection.series[0]).toMatchObject({ status: 'ready' });
expect(projection.gameSlots[0]).toMatchObject({ status: 'ready' });
expect(projection.games).toEqual([]);
});
});
function fixedGames(gameCount: number) {