T07b: frontend feature pages — companies + contacts + settings + audit + dashboard + search
- 11 new feature pages (CompaniesList/Detail/Form, ContactsList/Detail/Form, SettingsProfile/Roles/Users, AuditLog, GlobalSearchResults) - 3 page updates (Dashboard with StatCard+ActivityFeed, Settings with tree nav+Outlet, TopBar with SearchDropdown) - 13 new routes in routes/index.tsx - i18n updates (de.json + en.json) with companies/contacts/settings/audit/search keys - 12 new test files + 2 existing test fixes (TopBar, AppShell) - 7 shared components (DataGrid, Tabs, SearchDropdown, CsvImportDialog, StatCard, ActivityFeed, UnsavedChangesGuard) - 16 new API hooks in hooks.ts - Verification: 141 tests pass, build succeeds, tsc --noEmit clean
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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 { DashboardPage } from '@/pages/Dashboard';
|
||||
|
||||
vi.mock('@/api/hooks', () => ({
|
||||
useCompanies: () => ({ data: { items: [], total: 24 }, isLoading: false }),
|
||||
useContacts: () => ({ data: { items: [], total: 156 }, isLoading: false }),
|
||||
useAuditLog: () => ({
|
||||
data: {
|
||||
items: [
|
||||
{ timestamp: '2025-06-29T10:00:00Z', user: 'anna.schmidt', action: 'create', entity: 'company', entity_id: '1', details: 'Firma erstellt' },
|
||||
],
|
||||
total: 1,
|
||||
},
|
||||
isError: false,
|
||||
}),
|
||||
}));
|
||||
|
||||
describe('DashboardPage', () => {
|
||||
it('renders dashboard page', () => {
|
||||
render(<MemoryRouter><DashboardPage /></MemoryRouter>);
|
||||
expect(screen.getByTestId('dashboard-page')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders stat cards', () => {
|
||||
render(<MemoryRouter><DashboardPage /></MemoryRouter>);
|
||||
expect(screen.getByTestId('stat-companies')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('stat-contacts')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user