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