Add unit tests for OAuthButtons and LinkedAccountsSettings components
- Introduced comprehensive test coverage for `OAuthButtons` and `LinkedAccountsSettings`, including loading states, button behaviors, error handling, and custom class support. - Implemented `LinkedAccountsPage` tests for rendering and component integration. - Adjusted E2E coverage exclusions in various components, focusing on UI-heavy and animation-based flows best suited for E2E tests. - Refined Jest coverage thresholds to align with improved unit test additions.
This commit is contained in:
41
frontend/tests/app/settings/accounts/page.test.tsx
Normal file
41
frontend/tests/app/settings/accounts/page.test.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Tests for Linked Accounts Settings Page
|
||||
*/
|
||||
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import LinkedAccountsPage from '@/app/[locale]/(authenticated)/settings/accounts/page';
|
||||
|
||||
// Mock next-intl
|
||||
jest.mock('next-intl', () => ({
|
||||
useTranslations: () => (key: string) => {
|
||||
const translations: Record<string, string> = {
|
||||
pageTitle: 'Linked Accounts',
|
||||
pageSubtitle: 'Manage your linked social accounts for quick sign-in',
|
||||
};
|
||||
return translations[key] || key;
|
||||
},
|
||||
}));
|
||||
|
||||
// Mock the LinkedAccountsSettings component
|
||||
jest.mock('@/components/settings', () => ({
|
||||
LinkedAccountsSettings: () => (
|
||||
<div data-testid="linked-accounts-settings">Mocked LinkedAccountsSettings</div>
|
||||
),
|
||||
}));
|
||||
|
||||
describe('LinkedAccountsPage', () => {
|
||||
it('renders page title and subtitle', () => {
|
||||
render(<LinkedAccountsPage />);
|
||||
|
||||
expect(screen.getByText('Linked Accounts')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText('Manage your linked social accounts for quick sign-in')
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders LinkedAccountsSettings component', () => {
|
||||
render(<LinkedAccountsPage />);
|
||||
|
||||
expect(screen.getByTestId('linked-accounts-settings')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user