fix: close competition cutover integrity gaps

This commit is contained in:
dahyeon committed 2026-07-12 21:22:22 +00:00
1 parent 7ea2002975
commit 683d602d63
57 files changed
+4805 -1582

No files matched your search

@@ -1,7 +1,9 @@
import 'reflect-metadata';
import { BadRequestException, ValidationPipe } from '@nestjs/common';
import { plainToInstance } from 'class-transformer';
import { validateSync } from 'class-validator';
import { CreateMatchDto } from './create-match.dto';
import mongoose from 'mongoose';
import { CreateMatchDto, JoinMatchDto } from './create-match.dto';
describe('CreateMatchDto game mode cutover', () => {
it('rejects the removed live bracket mode', () => {
@@ -31,3 +33,31 @@ describe('CreateMatchDto game mode cutover', () => {
},
);
});
describe('JoinMatchDto self-join boundary', () => {
it('rejects a caller-supplied userId', async () => {
const pipe = new ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,
transform: true,
});
try {
await pipe.transform(
{
preferredPositions: [{ position: 'MID', priority: 1 }],
userId: new mongoose.Types.ObjectId().toString(),
},
{ type: 'body', metatype: JoinMatchDto },
);
throw new Error('Expected validation to reject userId.');
} catch (error) {
expect(error).toBeInstanceOf(BadRequestException);
expect((error as BadRequestException).getResponse()).toEqual({
error: 'Bad Request',
message: ['property userId should not exist'],
statusCode: 400,
});
}
});
});