resolve todos in website
This commit is contained in:
@@ -14,6 +14,9 @@ export class ProtestViewModel {
|
||||
status: string;
|
||||
reviewedAt?: string;
|
||||
decisionNotes?: string;
|
||||
incident?: { lap?: number } | null;
|
||||
proofVideoUrl?: string | null;
|
||||
comment?: string | null;
|
||||
|
||||
constructor(dto: ProtestDTO) {
|
||||
this.id = dto.id;
|
||||
|
||||
@@ -252,6 +252,36 @@ describe('RaceDetailViewModel', () => {
|
||||
expect(viewModel.registrationStatusMessage).toBe('Registration not available');
|
||||
});
|
||||
|
||||
it('should expose canReopenRace for completed and cancelled statuses', () => {
|
||||
const completedVm = new RaceDetailViewModel({
|
||||
race: createMockRace({ status: 'completed' }),
|
||||
league: createMockLeague(),
|
||||
entryList: [],
|
||||
registration: createMockRegistration(),
|
||||
userResult: null,
|
||||
});
|
||||
|
||||
const cancelledVm = new RaceDetailViewModel({
|
||||
race: createMockRace({ status: 'cancelled' as any }),
|
||||
league: createMockLeague(),
|
||||
entryList: [],
|
||||
registration: createMockRegistration(),
|
||||
userResult: null,
|
||||
});
|
||||
|
||||
const upcomingVm = new RaceDetailViewModel({
|
||||
race: createMockRace({ status: 'upcoming' }),
|
||||
league: createMockLeague(),
|
||||
entryList: [],
|
||||
registration: createMockRegistration(),
|
||||
userResult: null,
|
||||
});
|
||||
|
||||
expect(completedVm.canReopenRace).toBe(true);
|
||||
expect(cancelledVm.canReopenRace).toBe(true);
|
||||
expect(upcomingVm.canReopenRace).toBe(false);
|
||||
});
|
||||
|
||||
it('should handle error property', () => {
|
||||
const viewModel = new RaceDetailViewModel({
|
||||
race: createMockRace(),
|
||||
|
||||
@@ -70,4 +70,10 @@ export class RaceDetailViewModel {
|
||||
if (this.canRegister) return 'You can register for this race';
|
||||
return 'Registration not available';
|
||||
}
|
||||
|
||||
/** UI-specific: Whether race can be re-opened */
|
||||
get canReopenRace(): boolean {
|
||||
if (!this.race) return false;
|
||||
return this.race.status === 'completed' || this.race.status === 'cancelled';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user