- Replaced static paths with dynamic locale subpaths (`/[locale]/*`) in imports, URLs, and assertions across tests. - Updated `next-intl` mocks for improved compatibility with `locale`-aware components. - Standardized `page.goto` and navigation tests with `/en` as the base locale for consistency.
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
/**
|
|
* Tests for Password Settings Page
|
|
* Smoke tests for page rendering
|
|
*/
|
|
|
|
import { render, screen } from '@testing-library/react';
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
import PasswordSettingsPage from '@/app/[locale]/(authenticated)/settings/password/page';
|
|
|
|
describe('PasswordSettingsPage', () => {
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: { retry: false },
|
|
mutations: { retry: false },
|
|
},
|
|
});
|
|
|
|
const renderWithProvider = (component: React.ReactElement) => {
|
|
return render(<QueryClientProvider client={queryClient}>{component}</QueryClientProvider>);
|
|
};
|
|
|
|
it('renders without crashing', () => {
|
|
renderWithProvider(<PasswordSettingsPage />);
|
|
expect(screen.getByText('Password Settings')).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders heading', () => {
|
|
renderWithProvider(<PasswordSettingsPage />);
|
|
expect(screen.getByRole('heading', { name: /password settings/i })).toBeInTheDocument();
|
|
});
|
|
|
|
it('shows description text', () => {
|
|
renderWithProvider(<PasswordSettingsPage />);
|
|
expect(screen.getByText(/change your password/i)).toBeInTheDocument();
|
|
});
|
|
});
|