45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import type { LeagueAdminRosterJoinRequestViewModel } from './LeagueAdminRosterJoinRequestViewModel';
|
|
|
|
describe('LeagueAdminRosterJoinRequestViewModel', () => {
|
|
it('requires and exposes expected fields', () => {
|
|
const vm: LeagueAdminRosterJoinRequestViewModel = {
|
|
id: 'req-1',
|
|
leagueId: 'league-1',
|
|
driverId: 'driver-1',
|
|
driverName: 'Driver One',
|
|
requestedAtIso: '2025-01-02T03:04:05.000Z',
|
|
};
|
|
|
|
expect(vm.id).toBe('req-1');
|
|
expect(vm.leagueId).toBe('league-1');
|
|
expect(vm.driverId).toBe('driver-1');
|
|
expect(vm.driverName).toBe('Driver One');
|
|
expect(vm.requestedAtIso).toBe('2025-01-02T03:04:05.000Z');
|
|
|
|
expect(typeof vm.id).toBe('string');
|
|
expect(typeof vm.leagueId).toBe('string');
|
|
expect(typeof vm.driverId).toBe('string');
|
|
expect(typeof vm.driverName).toBe('string');
|
|
expect(typeof vm.requestedAtIso).toBe('string');
|
|
});
|
|
|
|
it('supports optional message', () => {
|
|
const withoutMessage: LeagueAdminRosterJoinRequestViewModel = {
|
|
id: 'req-1',
|
|
leagueId: 'league-1',
|
|
driverId: 'driver-1',
|
|
driverName: 'Driver One',
|
|
requestedAtIso: '2025-01-02T03:04:05.000Z',
|
|
};
|
|
|
|
const withMessage: LeagueAdminRosterJoinRequestViewModel = {
|
|
...withoutMessage,
|
|
message: 'Please approve',
|
|
};
|
|
|
|
expect(withoutMessage.message).toBeUndefined();
|
|
expect(withMessage.message).toBe('Please approve');
|
|
expect(typeof withMessage.message).toBe('string');
|
|
});
|
|
}); |