98 lines
2.8 KiB
TypeScript
98 lines
2.8 KiB
TypeScript
import { presentCompetitionDetail } from './competition.presenter';
|
|
|
|
describe('presentCompetitionDetail', () => {
|
|
it('returns the explicit public contract without persistence-only fields', () => {
|
|
const response = presentCompetitionDetail({
|
|
_id: objectId('competition-1'),
|
|
matchId: objectId('match-1'),
|
|
communityId: objectId('community-1'),
|
|
schemaVersion: 1,
|
|
projectorVersion: 3,
|
|
revision: 7,
|
|
phase: 'running',
|
|
teams: [
|
|
{
|
|
teamId: objectId('team-8'),
|
|
legacyTeamIndex: 8,
|
|
displayOrder: 2,
|
|
seedNumber: 2,
|
|
name: '똥칼라파워',
|
|
captainUserId: objectId('captain-8'),
|
|
members: [
|
|
{
|
|
userId: objectId('user-8'),
|
|
displayName: 'player 8',
|
|
gameName: '칼라',
|
|
tagLine: 'KR1',
|
|
assignedPosition: 'MID',
|
|
cost: 42,
|
|
secretPuuid: 'must-not-leak',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
format: {
|
|
type: 'paired-series',
|
|
rule: { type: 'fixed-games', gameCount: 3, drawPolicy: 'allow' },
|
|
},
|
|
seriesGraph: [{ internal: true }],
|
|
projection: {
|
|
sourceRevision: 7,
|
|
projectorVersion: 3,
|
|
phase: 'running',
|
|
formatType: 'paired-series',
|
|
series: [],
|
|
games: [],
|
|
gameSlots: [],
|
|
rounds: [],
|
|
connectors: [],
|
|
},
|
|
internalCommandReceipts: [{ idempotencyKey: 'secret' }],
|
|
createdAt: new Date('2026-07-11T00:00:00.000Z'),
|
|
updatedAt: new Date('2026-07-12T00:00:00.000Z'),
|
|
});
|
|
|
|
expect(response).toMatchObject({
|
|
id: 'competition-1',
|
|
matchId: 'match-1',
|
|
communityId: 'community-1',
|
|
schemaVersion: 1,
|
|
revision: 7,
|
|
phase: 'running',
|
|
createdAt: '2026-07-11T00:00:00.000Z',
|
|
updatedAt: '2026-07-12T00:00:00.000Z',
|
|
teams: [
|
|
{
|
|
teamId: 'team-8',
|
|
displayOrder: 2,
|
|
name: '똥칼라파워',
|
|
captainUserId: 'captain-8',
|
|
members: [
|
|
{
|
|
userId: 'user-8',
|
|
displayName: 'player 8',
|
|
gameName: '칼라',
|
|
tagLine: 'KR1',
|
|
assignedPosition: 'MID',
|
|
cost: 42,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
projection: {
|
|
sourceRevision: 7,
|
|
projectorVersion: 3,
|
|
},
|
|
});
|
|
expect(response).not.toHaveProperty('seriesGraph');
|
|
expect(response).not.toHaveProperty('internalCommandReceipts');
|
|
expect(response.teams[0]).not.toHaveProperty('legacyTeamIndex');
|
|
expect(response.teams[0]).not.toHaveProperty('seedNumber');
|
|
expect(response.teams[0].members[0]).not.toHaveProperty('secretPuuid');
|
|
});
|
|
});
|
|
|
|
function objectId(value: string) {
|
|
return { toString: () => value };
|
|
}
|