From b77c246df4ceb0f7b86827d98e2b4558d8a1e4b7 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 1 Dec 2026 13:44:02 +0100 Subject: [PATCH] fix(deps): keep Lucide SVG markup and Undici tests compatible Build standalone SVG icons without a React context. Use accessible actions in tests and give the mocked dispatchers the interface the adapter expects. --- client/package.json | 1 + .../components/Admin/AdminPluginsPanel.tsx | 3 +- .../src/components/Admin/BackupPanel.test.tsx | 11 ++-- .../Journey/MobileEntryView.test.tsx | 6 +-- .../components/Journey/MobileEntryView.tsx | 1 + .../SystemNotices/ReleaseNoticeVisuals.tsx | 4 +- .../SystemNotices/SystemNoticeModal.tsx | 6 +-- client/src/components/shared/PluginIcon.tsx | 17 +------ .../src/components/shared/lucideIconLookup.ts | 20 ++++++++ client/src/utils/iconMarkup.ts | 50 +++++++++++++++++-- package-lock.json | 7 +++ .../tests/unit/utils/ssrf-llm-timeout.test.ts | 9 +++- server/tests/unit/utils/ssrf-proxy.test.ts | 2 + .../unit/utils/ssrf-response-limits.test.ts | 9 +++- server/tests/unit/utils/ssrfGuard.test.ts | 1 + 15 files changed, 107 insertions(+), 40 deletions(-) create mode 100644 client/src/components/shared/lucideIconLookup.ts diff --git a/client/package.json b/client/package.json index 77640e9e3..77f23d843 100644 --- a/client/package.json +++ b/client/package.json @@ -101,6 +101,7 @@ "@fontsource/satisfy": "^5.3.0", "@fontsource/shrikhand": "^5.3.0", "@fontsource/yellowtail": "^5.3.0", + "@lucide/icons": "1.82.0", "@maplibre/maplibre-gl-leaflet": "0.1.4", "@noble/hashes": "^2.4.0", "@simplewebauthn/browser": "^14.0.0", diff --git a/client/src/components/Admin/AdminPluginsPanel.tsx b/client/src/components/Admin/AdminPluginsPanel.tsx index c1fdd3a54..2ad00c294 100644 --- a/client/src/components/Admin/AdminPluginsPanel.tsx +++ b/client/src/components/Admin/AdminPluginsPanel.tsx @@ -6,7 +6,6 @@ import { Globe, History, Puzzle, Bot, Loader2, } from 'lucide-react' import PluginIcon from '../shared/PluginIcon' -import { Github } from '../shared/legacyLucideIcons' import { useInstanceSettings } from './useInstanceSettings' import { type RangeWarning } from './useRangeBypass' import { deriveCaps } from './pluginCaps' @@ -790,7 +789,7 @@ function PluginDetailModal({ item, installed, busy, onInstall, onClose, t, local footer={( - + diff --git a/client/src/components/Admin/BackupPanel.test.tsx b/client/src/components/Admin/BackupPanel.test.tsx index 8b3025b0f..c4ef27daf 100644 --- a/client/src/components/Admin/BackupPanel.test.tsx +++ b/client/src/components/Admin/BackupPanel.test.tsx @@ -210,11 +210,8 @@ describe('BackupPanel', () => { await waitFor(() => { expect(screen.getByText('backup-2025-01-15.zip')).toBeInTheDocument() }) - const trashBtn = Array.from(document.querySelectorAll('button')).find( - b => b.querySelector('svg.lucide-trash2'), - ) as HTMLElement - expect(trashBtn).toBeTruthy() - await user.click(trashBtn!) + const trashBtn = screen.getByRole('button', { name: 'Delete' }) + await user.click(trashBtn) // The question is the shared confirm dialog now, not window.confirm expect(await screen.findByText('Delete backup "backup-2025-01-15.zip"?')).toBeInTheDocument() const deleteButtons = screen.getAllByRole('button', { name: 'Delete' }) @@ -428,9 +425,7 @@ describe('BackupPanel', () => { render(<>) await screen.findByText('backup-2025-01-15.zip') - const trashBtn = Array.from(document.querySelectorAll('button')).find( - b => b.querySelector('svg.lucide-trash2'), - ) as HTMLElement + const trashBtn = screen.getByRole('button', { name: 'Delete' }) await user.click(trashBtn) await user.click(await screen.findByRole('button', { name: 'Cancel' })) expect(deleteCalls).toBe(0) diff --git a/client/src/components/Journey/MobileEntryView.test.tsx b/client/src/components/Journey/MobileEntryView.test.tsx index 22f64c229..045fdbe1f 100644 --- a/client/src/components/Journey/MobileEntryView.test.tsx +++ b/client/src/components/Journey/MobileEntryView.test.tsx @@ -113,9 +113,9 @@ describe('MobileEntryView', () => { const order: string[] = [] const onClose = vi.fn(() => { order.push('close') }) const onDelete = vi.fn(() => { order.push('delete') }) - const { container } = renderView(buildEntry(), { onClose, onDelete }) + renderView(buildEntry(), { onClose, onDelete }) - fireEvent.click(container.querySelector('svg.lucide-trash2')!.closest('button')!) + fireEvent.click(screen.getByRole('button', { name: /Delete/ })) expect(order).toEqual(['close', 'delete']) }) @@ -123,7 +123,7 @@ describe('MobileEntryView', () => { it('FE-COMP-JENTRYVIEW-006: read-only journeys hide the edit and delete actions', () => { const { container } = renderView(buildEntry(), { readOnly: true }) expect(screen.queryByRole('button', { name: /Edit/ })).not.toBeInTheDocument() - expect(container.querySelector('svg.lucide-trash2')).toBeNull() + expect(screen.queryByRole('button', { name: /Delete/ })).not.toBeInTheDocument() // the close button stays expect(container.querySelector('svg.lucide-x')).not.toBeNull() }) diff --git a/client/src/components/Journey/MobileEntryView.tsx b/client/src/components/Journey/MobileEntryView.tsx index 92ab5a0b9..977f285b3 100644 --- a/client/src/components/Journey/MobileEntryView.tsx +++ b/client/src/components/Journey/MobileEntryView.tsx @@ -104,6 +104,7 @@ export default function MobileEntryView({ entry, readOnly, publicPhotoUrl, onClo