21 lines
632 B
TypeScript
21 lines
632 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { RaceWithSOFViewModel } from './RaceWithSOFViewModel';
|
|
import type { RaceWithSOFDTO } from '../types/generated/RaceWithSOFDTO';
|
|
|
|
const createDto = (overrides: Partial<RaceWithSOFDTO> = {}): RaceWithSOFDTO => ({
|
|
id: 'race-sof-1',
|
|
track: 'Spa',
|
|
...overrides,
|
|
});
|
|
|
|
describe('RaceWithSOFViewModel', () => {
|
|
it('maps DTO fields', () => {
|
|
const dto = createDto({ id: 'race-sof-123', track: 'Nürburgring' });
|
|
|
|
const viewModel = new RaceWithSOFViewModel(dto);
|
|
|
|
expect(viewModel.id).toBe('race-sof-123');
|
|
expect(viewModel.track).toBe('Nürburgring');
|
|
});
|
|
});
|