refactor: remove legacy match result writers
This commit is contained in:
1 parent
ce07bfa0c8
commit
2958106e42
4 files changed
+48
-319
No files matched your search
@@ -0,0 +1,42 @@
|
||||
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,
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user