move static data

This commit is contained in:
2025-12-26 00:20:53 +01:00
parent c977defd6a
commit b6cbb81388
63 changed files with 1482 additions and 418 deletions

View File

@@ -1,18 +1,21 @@
import { describe, it, expect } from 'vitest';
import { TeamJoinRequestViewModel, type TeamJoinRequestDTO } from './TeamJoinRequestViewModel';
import { TeamJoinRequestViewModel } from './TeamJoinRequestViewModel';
import type { TeamJoinRequestDTO } from '@/lib/types/generated/TeamJoinRequestDTO';
const createTeamJoinRequestDto = (overrides: Partial<TeamJoinRequestDTO> = {}): TeamJoinRequestDTO => ({
id: 'request-1',
requestId: 'request-1',
teamId: 'team-1',
driverId: 'driver-1',
driverName: 'Driver One',
status: 'pending',
requestedAt: '2024-01-01T12:00:00Z',
message: 'Please let me join',
avatarUrl: 'https://example.com/avatar.jpg',
...overrides,
});
describe('TeamJoinRequestViewModel', () => {
it('maps fields from DTO', () => {
const dto = createTeamJoinRequestDto({ id: 'req-123', driverId: 'driver-123' });
const dto = createTeamJoinRequestDto({ requestId: 'req-123', driverId: 'driver-123' });
const vm = new TeamJoinRequestViewModel(dto, 'current-user', true);
@@ -20,7 +23,6 @@ describe('TeamJoinRequestViewModel', () => {
expect(vm.teamId).toBe('team-1');
expect(vm.driverId).toBe('driver-123');
expect(vm.requestedAt).toBe('2024-01-01T12:00:00Z');
expect(vm.message).toBe('Please let me join');
});
it('allows approval only for owners', () => {
@@ -34,7 +36,7 @@ describe('TeamJoinRequestViewModel', () => {
});
it('exposes a pending status with yellow color', () => {
const dto = createTeamJoinRequestDto();
const dto = createTeamJoinRequestDto({ status: 'pending' });
const vm = new TeamJoinRequestViewModel(dto, 'owner-user', true);
expect(vm.status).toBe('Pending');