43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { PATH_METADATA } from '@nestjs/common/constants';
|
|
import { MatchController } from './match.controller';
|
|
import { MatchService } from './match.service';
|
|
|
|
const LEGACY_RESULT_METHODS = [
|
|
'applyDoubleEliminationWalkover',
|
|
'cancelDoubleEliminationWalkover',
|
|
'cancelDoubleEliminationRiotResult',
|
|
] as const;
|
|
|
|
describe('Match result ownership cutover', () => {
|
|
it('does not expose legacy Match result mutation routes', () => {
|
|
const routes = Object.getOwnPropertyNames(MatchController.prototype)
|
|
.map((name) => {
|
|
const handler = Object.getOwnPropertyDescriptor(
|
|
MatchController.prototype,
|
|
name,
|
|
)?.value as unknown;
|
|
return typeof handler === 'function'
|
|
? (Reflect.getMetadata(PATH_METADATA, handler) as unknown)
|
|
: undefined;
|
|
})
|
|
.filter((path): path is string => typeof path === 'string');
|
|
|
|
expect(routes).not.toEqual(
|
|
expect.arrayContaining([
|
|
':matchId/double-elimination/bracket-matches/:bracketMatchId/walkover',
|
|
':matchId/double-elimination/bracket-matches/:bracketMatchId/walkover/cancel',
|
|
':matchId/double-elimination/bracket-matches/:bracketMatchId/result/cancel',
|
|
]),
|
|
);
|
|
});
|
|
|
|
it.each(LEGACY_RESULT_METHODS)(
|
|
'removes the legacy MatchService.%s result writer',
|
|
(methodName) => {
|
|
expect(Object.getOwnPropertyNames(MatchService.prototype)).not.toContain(
|
|
methodName,
|
|
);
|
|
},
|
|
);
|
|
});
|