- 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.
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
/**
|
|
* 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();
|
|
});
|
|
});
|