fix: Fix all 68 frontend test failures

P1 Code Bugs:
- SettingsPlugins.tsx: Array.isArray guard for plugins.map (9 tests)
- HtmlBlock.tsx: javascript: URL sanitization in href attributes (1 test, security fix)

P2 Test-Setup (QueryClientProvider):
- Dashboard.test.tsx: Add QueryClientProvider + dashboard mock (11 tests)
- CalendarPage.test.tsx: Add QueryClientProvider + savedFilters mock (8 tests)
- SessionList.test.tsx: Add QueryClientProvider (6 tests)
- MailPage.test.tsx: Add QueryClientProvider + savedFilters mock (8 tests fixed)
- DmsPage.test.tsx: Add QueryClientProvider + DMS API mocks (2 tests fixed)
- SettingsSystem.test.tsx: Add QueryClientProvider + sub-page mocks (1 test fixed)

P2 Test-Setup (ChevronDown Mock):
- Reports.test.tsx: Add ChevronDown to lucide-react mock (5 tests)

P3 Text Fix:
- UploadDropzone.test.tsx: Fix umlaut Auswaehlen -> Auswahlen (1 test)

Pre-existing Test Fixes (18 tests):
- MailPage.test.tsx: Remove 6 obsolete tests (compose-btn, shared-mailbox-selector, etc. — now plugin toolbar actions)
- DmsPage.test.tsx: Adapt 3 tests to new testids, remove 3 obsolete tests (upload/folder/search now plugin toolbar actions)
- SettingsSystem.test.tsx: Remove 4 obsolete tests (form fields moved to sub-pages)
- PluginRouteRenderer.test.tsx: Adapt test to loading spinner behavior
- ShareDialog.test.tsx: Fix button text i18n mismatch
This commit is contained in:
Agent Zero
2026-08-04 19:25:44 +02:00
parent 2bacadabc2
commit 17765e47b4
12 changed files with 190 additions and 131 deletions
@@ -93,7 +93,7 @@ describe('ShareDialog', () => {
render(<ShareDialog open={true} file={mockFile} onClose={vi.fn()} onShared={vi.fn()} />);
const userIdInput = screen.getByLabelText('Benutzer-ID');
fireEvent.change(userIdInput, { target: { value: 'u5' } });
const addBtn = screen.getByRole('button', { name: 'Freigabe hinzufuegen' });
const addBtn = screen.getByRole('button', { name: 'Freigabe hinzufügen' });
fireEvent.click(addBtn);
await waitFor(() => {
expect(shareFile).toHaveBeenCalledWith('file1', { user_id: 'u5', permission: 'read' });