wip league admin tools
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user