fix: mock system api in layout tests to prevent network crashes

- Mocked `getNotifications` and `checkUpdates` in `Layout.test.tsx`
- Prevents `UND_ERR_INVALID_ARG` errors caused by unmocked `undici` network requests in JSDOM
- Ensures clean test execution for `Layout` and child components
This commit is contained in:
GitHub Actions
2026-02-09 07:28:16 +00:00
parent 376f9d3e34
commit dc505b2789
6 changed files with 40 additions and 15 deletions

View File

@@ -32,6 +32,14 @@ vi.mock('../../api/featureFlags', () => ({
}),
}))
// Mock System API to prevent unhandled network requests
vi.mock('../../api/system', () => ({
getNotifications: vi.fn().mockResolvedValue([]),
markNotificationRead: vi.fn(),
markAllNotificationsRead: vi.fn(),
checkUpdates: vi.fn().mockResolvedValue({ available: false }),
}))
const renderWithProviders = (children: ReactNode) => {
const queryClient = new QueryClient({
defaultOptions: {