fix(api): resolve formatting and iterator lint errors

This commit is contained in:
dahyeon committed 2026-11-11 02:06:40 +09:00
1 parent 0d7617e2d2
commit f6686bbf17
6 files changed
+43 -19

No files matched your search

@@ -222,7 +222,9 @@ describe('CommunityStatsService', () => {
const setDetail = jest.fn();
const service = new CommunityStatsService(
{
getModel: async () => ({ exists: () => ({ exec: async () => null }) }),
getModel: async () => ({
exists: () => ({ exec: async () => null }),
}),
} as unknown as ConnectionService,
{
get: async () => null,
@@ -649,9 +649,8 @@ export class CommunityStatsService {
if (retryAt <= now) this.rawRecoveryRetryAfter.delete(field);
}
if (this.rawRecoveryRetryAfter.size >= 1000) {
this.rawRecoveryRetryAfter.delete(
this.rawRecoveryRetryAfter.keys().next().value!,
);
const oldest = this.rawRecoveryRetryAfter.keys().next();
if (!oldest.done) this.rawRecoveryRetryAfter.delete(oldest.value);
}
this.rawRecoveryRetryAfter.set(
key.field,
@@ -40,7 +40,10 @@ export const MATCH_STATUSES: MatchStatus[] = [
'finished',
];
export const MATCH_EVENT_TYPES = ['inhouse', 'tournament'] as const satisfies readonly MatchEventType[];
export const MATCH_EVENT_TYPES = [
'inhouse',
'tournament',
] as const satisfies readonly MatchEventType[];
export type TeamSide = 'blue' | 'red';
export const TEAM_SIDES: TeamSide[] = ['blue', 'red'];
@@ -2554,7 +2557,10 @@ MatchStatsSchema.index({
MatchStatsSchema.index({ communityId: 1, userIds: 1 });
MatchStatsSchema.index({ communityId: 1, userIds: 1, scheduledAt: -1 });
MatchStatsSchema.index({ communityId: 1, championIds: 1 });
MatchStatsSchema.index(MATCH_STATS_RIOT_MATCH_INDEX.key, MATCH_STATS_RIOT_MATCH_INDEX.options);
MatchStatsSchema.index(
MATCH_STATS_RIOT_MATCH_INDEX.key,
MATCH_STATS_RIOT_MATCH_INDEX.options,
);
export const tournamentModelDefinitions: Array<
ModelDefinition & { name: keyof TournamentModelTypes }
@@ -3,7 +3,11 @@ import { BadRequestException, ValidationPipe } from '@nestjs/common';
import { plainToInstance } from 'class-transformer';
import { validateSync } from 'class-validator';
import mongoose from 'mongoose';
import { CreateMatchDto, JoinMatchDto, UpdateMatchDto } from './create-match.dto';
import {
CreateMatchDto,
JoinMatchDto,
UpdateMatchDto,
} from './create-match.dto';
describe('CreateMatchDto game mode cutover', () => {
it('rejects the removed live bracket mode', () => {
@@ -75,7 +79,9 @@ describe('Grand final format validation', () => {
doubleEliminationGrandFinalGameCount: 2,
});
expect(validateSync(update)).toEqual([
expect.objectContaining({ property: 'doubleEliminationGrandFinalGameCount' }),
expect.objectContaining({
property: 'doubleEliminationGrandFinalGameCount',
}),
]);
});
});
@@ -93,16 +99,19 @@ describe('Match event type validation', () => {
}),
),
).toEqual([]);
expect(validateSync(plainToInstance(UpdateMatchDto, { eventType }))).toEqual(
[],
);
expect(
validateSync(plainToInstance(UpdateMatchDto, { eventType })),
).toEqual([]);
},
);
it.each(['double-elimination', null])('rejects %s as an event type', (eventType) => {
const dto = plainToInstance(UpdateMatchDto, { eventType });
expect(validateSync(dto)).toEqual([
expect.objectContaining({ property: 'eventType' }),
]);
});
it.each(['double-elimination', null])(
'rejects %s as an event type',
(eventType) => {
const dto = plainToInstance(UpdateMatchDto, { eventType });
expect(validateSync(dto)).toEqual([
expect.objectContaining({ property: 'eventType' }),
]);
},
);
});
@@ -26,7 +26,10 @@ interface PublicMatchSource {
gameCount: number;
gameMode: MatchGameMode;
roundRobinMaxRounds?: number;
doubleElimination?: { resetFinalEnabled?: boolean; grandFinalGameCount?: 1 | 3 | 5 };
doubleElimination?: {
resetFinalEnabled?: boolean;
grandFinalGameCount?: 1 | 3 | 5;
};
hostUserId?: IdLike;
participants: Array<{
userId: IdLike;
@@ -69,7 +69,12 @@ describe('MatchController partial updates', () => {
const controller = new MatchController(matchService as never);
const body = plainToInstance(UpdateMatchDto, { eventType: 'tournament' });
await controller.updateMatch(user as UserDocument, communityId, matchId, body);
await controller.updateMatch(
user as UserDocument,
communityId,
matchId,
body,
);
expect(matchService.update).toHaveBeenCalledWith({
communityId,