32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
|
|
import React from 'react';
|
||
|
|
import { describe, it, expect, vi } from 'vitest';
|
||
|
|
import { render, screen } from '@testing-library/react';
|
||
|
|
import { MemoryRouter } from 'react-router-dom';
|
||
|
|
import { CompanyDetailPage } from '@/pages/CompanyDetail';
|
||
|
|
|
||
|
|
vi.mock('@/api/hooks', () => ({
|
||
|
|
useCompany: () => ({
|
||
|
|
data: {
|
||
|
|
id: '1', name: 'TestCorp GmbH', email: 'info@testcorp.de',
|
||
|
|
phone: '+49 30 12345678', website: 'https://testcorp.de',
|
||
|
|
industry: 'IT', address: 'Berlin', city: 'Berlin',
|
||
|
|
zip_code: '10115', country: 'Deutschland',
|
||
|
|
created_at: '2025-01-01T00:00:00Z', updated_at: '2025-01-01T00:00:00Z',
|
||
|
|
contacts: [],
|
||
|
|
},
|
||
|
|
isLoading: false,
|
||
|
|
}),
|
||
|
|
}));
|
||
|
|
|
||
|
|
describe('CompanyDetailPage', () => {
|
||
|
|
it('renders the detail page', () => {
|
||
|
|
render(<MemoryRouter initialEntries={['/companies/1']}><CompanyDetailPage /></MemoryRouter>);
|
||
|
|
expect(screen.getByTestId('company-detail-page')).toBeInTheDocument();
|
||
|
|
});
|
||
|
|
|
||
|
|
it('renders tabs for detail sections', () => {
|
||
|
|
render(<MemoryRouter initialEntries={['/companies/1']}><CompanyDetailPage /></MemoryRouter>);
|
||
|
|
expect(screen.getByRole('tablist')).toBeInTheDocument();
|
||
|
|
});
|
||
|
|
});
|