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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user