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

@@ -19,17 +19,22 @@ describe('TeamJoinService', () => {
const mockDto = {
requests: [
{
id: 'request-1',
requestId: 'request-1',
teamId: 'team-1',
driverId: 'driver-1',
driverName: 'Driver One',
status: 'pending',
requestedAt: '2023-01-01T00:00:00Z',
message: 'Please accept me',
avatarUrl: 'https://example.com/avatar-1.jpg',
},
{
id: 'request-2',
requestId: 'request-2',
teamId: 'team-1',
driverId: 'driver-2',
driverName: 'Driver Two',
status: 'pending',
requestedAt: '2023-01-02T00:00:00Z',
avatarUrl: 'https://example.com/avatar-2.jpg',
},
],
};
@@ -40,20 +45,30 @@ describe('TeamJoinService', () => {
expect(mockApiClient.getJoinRequests).toHaveBeenCalledWith('team-1');
expect(result).toHaveLength(2);
expect(result[0].id).toBe('request-1');
expect(result[0].canApprove).toBe(true);
expect(result[1].id).toBe('request-2');
expect(result[1].canApprove).toBe(true);
const first = result[0];
const second = result[1];
expect(first).toBeDefined();
expect(second).toBeDefined();
expect(first!.id).toBe('request-1');
expect(first!.canApprove).toBe(true);
expect(second!.id).toBe('request-2');
expect(second!.canApprove).toBe(true);
});
it('should pass correct parameters to view model constructor', async () => {
const mockDto = {
requests: [
{
id: 'request-1',
requestId: 'request-1',
teamId: 'team-1',
driverId: 'driver-1',
driverName: 'Driver One',
status: 'pending',
requestedAt: '2023-01-01T00:00:00Z',
avatarUrl: 'https://example.com/avatar-1.jpg',
},
],
};
@@ -62,7 +77,8 @@ describe('TeamJoinService', () => {
const result = await service.getJoinRequests('team-1', 'user-1', false);
expect(result[0].canApprove).toBe(false);
expect(result[0]).toBeDefined();
expect(result[0]!.canApprove).toBe(false);
});
});

View File

@@ -34,7 +34,7 @@ export class TeamJoinService {
* a request requires a future management endpoint, so this method fails explicitly.
*/
async approveJoinRequest(): Promise<never> {
throw new Error('Approving team join requests is not supported in this build');
throw new Error('Not implemented: API endpoint for approving join requests');
}
/**
@@ -44,6 +44,6 @@ export class TeamJoinService {
* must treat this as an unsupported operation rather than a silent no-op.
*/
async rejectJoinRequest(): Promise<never> {
throw new Error('Rejecting team join requests is not supported in this build');
throw new Error('Not implemented: API endpoint for rejecting join requests');
}
}