fix: reject unfinishable first-to rules

This commit is contained in:
dahyeon committed 2026-07-12 20:01:22 +00:00
1 parent 0c2c7b59fc
commit 78a2c7cf0d
4 files changed
+47 -5

No files matched your search

@@ -243,6 +243,24 @@ describe('projectSeries', () => {
}),
).toMatchObject({ status: 'inactive' });
});
it('rejects an unfinishable persisted first-to definition', () => {
const definition = seriesDefinition({
id: 'series-unfinishable',
stage: 'upper',
rule: { type: 'first-to', winsRequired: 2, maxGames: 2 },
});
expectInvariant(
() =>
projectSeries({
definition,
participants: ['team-8', 'team-3'],
facts: [],
}),
'SERIES_DEFINITION_INVALID',
);
});
});
function seriesDefinition(params: {