feat: add limited round-robin scheduling
This commit is contained in:
1 parent
24983aeb09
commit
658592973e
15 files changed
+403
-63
No files matched your search
@@ -292,6 +292,29 @@ describe('MatchService', () => {
|
||||
expect(matchStatsService.removeByMatch).toHaveBeenCalledWith(match._id);
|
||||
});
|
||||
|
||||
it('rejects round-robin max round changes after recruiting', async () => {
|
||||
const communityId = new mongoose.Types.ObjectId();
|
||||
const match = {
|
||||
communityId,
|
||||
status: 'team-built',
|
||||
tournamentCodeIds: [],
|
||||
set: jest.fn(),
|
||||
save: jest.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
const { service } = createService(match);
|
||||
|
||||
await expect(
|
||||
service.update({
|
||||
matchId: new mongoose.Types.ObjectId(),
|
||||
communityId,
|
||||
patch: { roundRobinMaxRounds: 3 },
|
||||
}),
|
||||
).rejects.toThrow(
|
||||
'maxParticipants, gameMode, and roundRobinMaxRounds can only be changed while recruiting.',
|
||||
);
|
||||
expect(match.set).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('releases reserved codes when returning a built match to recruiting', async () => {
|
||||
const communityId = new mongoose.Types.ObjectId();
|
||||
const codeId = new mongoose.Types.ObjectId();
|
||||
|
||||
Reference in new issue
Block a user