Remove deprecated middleware and update component tests for branding and auth enhancements

- Deleted `middleware.disabled.ts` as it is no longer needed.
- Refactored `HeroSection` and `HomePage` tests to align with updated branding and messaging.
- Modified `DemoCredentialsModal` to support auto-filled demo credentials in login links.
- Mocked `ThemeToggle`, `LocaleSwitcher`, and `DemoCredentialsModal` in relevant tests.
- Updated admin tests to use `QueryClientProvider` and refactored API mocks for `AdminPage`.
- Replaced test assertions for stats section and badges with new branding content.
This commit is contained in:
Felipe Cardoso
2025-11-24 15:04:49 +01:00
parent acfe59c8b3
commit 13abd159fa
8 changed files with 131 additions and 112 deletions

View File

@@ -27,6 +27,24 @@ jest.mock('@/components/home/DemoCredentialsModal', () => ({
) : null,
}));
// Mock auth hooks
jest.mock('@/lib/api/hooks/useAuth', () => ({
useIsAuthenticated: jest.fn(() => false),
useLogout: jest.fn(() => ({
mutate: jest.fn(),
})),
}));
// Mock Theme components
jest.mock('@/components/theme', () => ({
ThemeToggle: () => <div data-testid="theme-toggle">Theme Toggle</div>,
}));
// Mock LocaleSwitcher
jest.mock('@/components/i18n', () => ({
LocaleSwitcher: () => <div data-testid="locale-switcher">Locale Switcher</div>,
}));
describe('Header', () => {
it('renders logo', () => {
render(
@@ -38,7 +56,6 @@ describe('Header', () => {
);
expect(screen.getByText('PragmaStack')).toBeInTheDocument();
expect(screen.getByText('Template')).toBeInTheDocument();
});
it('logo links to homepage', () => {
@@ -50,7 +67,7 @@ describe('Header', () => {
/>
);
const logoLink = screen.getByRole('link', { name: /pragmastack template/i });
const logoLink = screen.getByRole('link', { name: /PragmaStack/i });
expect(logoLink).toHaveAttribute('href', '/');
});