fix: close competition cutover integrity gaps
This commit is contained in:
1 parent
7ea2002975
commit
683d602d63
57 files changed
+4805
-1582
No files matched your search
@@ -193,8 +193,37 @@ describe('CompetitionBootstrapService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('rejects double elimination until authoritative seeds are persisted', async () => {
|
||||
const harness = createHarness();
|
||||
const service = new CompetitionBootstrapService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
|
||||
await expect(
|
||||
service.bootstrap(
|
||||
matchSnapshot({
|
||||
gameMode: 'double-elimination',
|
||||
teamCount: 4,
|
||||
gameCount: 3,
|
||||
}),
|
||||
),
|
||||
).rejects.toMatchObject({
|
||||
code: 'INVALID_MATCH_TEAM_SNAPSHOT',
|
||||
httpStatus: 422,
|
||||
});
|
||||
|
||||
expect(harness.connectionService.createSession).not.toHaveBeenCalled();
|
||||
expect(harness.competitionModel.findOneAndUpdate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('rejects incomplete and duplicate team assignments before opening a transaction', async () => {
|
||||
const cases: Array<[string, (match: CompetitionBootstrapMatch) => void]> = [
|
||||
[
|
||||
'the Match lifecycle is still recruiting',
|
||||
(match) => {
|
||||
match.status = 'recruiting';
|
||||
},
|
||||
],
|
||||
[
|
||||
'an active participant is not assigned',
|
||||
(match) => {
|
||||
@@ -288,6 +317,8 @@ describe('CompetitionBootstrapService', () => {
|
||||
expect(harness.matchModel.updateOne).toHaveBeenCalledWith(
|
||||
{
|
||||
_id: MATCH_ID,
|
||||
status: 'team-built',
|
||||
teamBuiltAt: new Date('2026-07-12T00:05:00.000Z'),
|
||||
$or: [
|
||||
{ competitionId: { $exists: false } },
|
||||
{ competitionId: null },
|
||||
@@ -404,6 +435,8 @@ function matchSnapshot(params: {
|
||||
return {
|
||||
_id: MATCH_ID,
|
||||
communityId: COMMUNITY_ID,
|
||||
status: 'team-built',
|
||||
teamBuiltAt: new Date('2026-07-12T00:05:00.000Z'),
|
||||
gameCount: params.gameCount ?? 3,
|
||||
gameMode: params.gameMode,
|
||||
...(params.roundRobinMaxRounds === undefined
|
||||
|
||||
Reference in new issue
Block a user