fix: make competition reversals replayable
This commit is contained in:
1 parent
4d6fa2625e
commit
ce07bfa0c8
6 files changed
+169
-13
No files matched your search
@@ -203,6 +203,46 @@ describe('projectSeries', () => {
|
||||
'SERIES_ALREADY_COMPLETED',
|
||||
);
|
||||
});
|
||||
|
||||
it('allows an inactive descendant after all of its historical activity was reversed', () => {
|
||||
const definition = seriesDefinition({
|
||||
id: 'series-reversed-descendant',
|
||||
stage: 'upper',
|
||||
rule: { type: 'first-to', winsRequired: 1, maxGames: 1 },
|
||||
});
|
||||
const accepted = acceptedGame({
|
||||
definition,
|
||||
ordinal: 1,
|
||||
blueTeamId: 'team-8',
|
||||
redTeamId: 'team-3',
|
||||
winnerTeamId: 'team-8',
|
||||
});
|
||||
|
||||
expect(
|
||||
projectSeries({
|
||||
definition,
|
||||
participants: [null, null],
|
||||
active: false,
|
||||
facts: [
|
||||
accepted,
|
||||
{
|
||||
id: 'fact-series-reversed-descendant-void',
|
||||
type: 'game-voided',
|
||||
competitionId: 'competition-series-projector',
|
||||
revision: 2,
|
||||
ordinalWithinRevision: 1,
|
||||
commandId: 'command-series-reversed-descendant-void',
|
||||
schemaVersion: 1,
|
||||
actor: { type: 'user' },
|
||||
occurredAt: new Date('2026-07-12T00:02:00.000Z'),
|
||||
recordedAt: new Date('2026-07-12T00:02:01.000Z'),
|
||||
gameAcceptedFactId: accepted.id,
|
||||
reason: 'Cascade reversal',
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toMatchObject({ status: 'inactive' });
|
||||
});
|
||||
});
|
||||
|
||||
function seriesDefinition(params: {
|
||||
|
||||
Reference in new issue
Block a user