55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
// @ts-nocheck
|
|
/**
|
|
* Unit tests for RaceCreationSuccessScreen component.
|
|
* Tests the UI rendering of race creation success result.
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
import { render, screen } from '@testing-library/react';
|
|
import { RaceCreationSuccessScreen } from '../../../apps/companion/renderer/components/RaceCreationSuccessScreen';
|
|
|
|
describe('RaceCreationSuccessScreen', () => {
|
|
const mockResult = {
|
|
sessionId: 'race-12345',
|
|
sessionName: 'Test Race',
|
|
trackId: 'spa',
|
|
carIds: ['porsche_911_gt3_r'],
|
|
finalPrice: '$0.50',
|
|
createdAt: new Date('2025-11-25T22:00:00.000Z'),
|
|
};
|
|
|
|
describe('Rendering', () => {
|
|
it('should render success message', () => {
|
|
render(<RaceCreationSuccessScreen result={mockResult} />);
|
|
|
|
expect(screen.getByText(/success/i)).toBeInTheDocument();
|
|
});
|
|
|
|
it('should display session information', () => {
|
|
render(<RaceCreationSuccessScreen result={mockResult} />);
|
|
|
|
expect(screen.getByText(/Test Race/)).toBeInTheDocument();
|
|
expect(screen.getByText(/race-12345/)).toBeInTheDocument();
|
|
});
|
|
|
|
it('should display track and car information', () => {
|
|
render(<RaceCreationSuccessScreen result={mockResult} />);
|
|
|
|
expect(screen.getByText(/spa/i)).toBeInTheDocument();
|
|
expect(screen.getByText(/porsche/i)).toBeInTheDocument();
|
|
});
|
|
|
|
it('should display final price', () => {
|
|
render(<RaceCreationSuccessScreen result={mockResult} />);
|
|
|
|
expect(screen.getByText(/\$0\.50/)).toBeInTheDocument();
|
|
});
|
|
|
|
it('should display creation timestamp', () => {
|
|
render(<RaceCreationSuccessScreen result={mockResult} />);
|
|
|
|
expect(screen.getByText(/2025-11-25/)).toBeInTheDocument();
|
|
});
|
|
});
|
|
}); |