test(frontend): improve test coverage and update edge case handling
- Refactor tests to handle empty `model_params` in AgentTypeForm. - Add return type annotations (`: never`) for throwing functions in ErrorBoundary tests. - Mock `useAuth` in home page tests for consistent auth state handling. - Update Header test to validate updated `/dashboard` link.
This commit is contained in:
@@ -55,6 +55,15 @@ jest.mock('@/lib/api/hooks/useAuth', () => ({
|
||||
})),
|
||||
}));
|
||||
|
||||
// Mock AuthContext - Home page uses useAuth to check if user is authenticated
|
||||
jest.mock('@/lib/auth/AuthContext', () => ({
|
||||
useAuth: jest.fn(() => ({
|
||||
isAuthenticated: false,
|
||||
isLoading: false,
|
||||
user: null,
|
||||
})),
|
||||
}));
|
||||
|
||||
// Mock Theme components
|
||||
jest.mock('@/components/theme', () => ({
|
||||
ThemeToggle: () => <div data-testid="theme-toggle">Theme Toggle</div>,
|
||||
|
||||
Reference in New Issue
Block a user