more refactor
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Has been cancelled

This commit is contained in:
2025-12-21 20:34:32 -08:00
parent 15f759cbc4
commit bc2c24bcff
46 changed files with 387 additions and 257 deletions

View File

@@ -28,7 +28,7 @@ const renderWithRouter = (profile: Profile | null, initialPath: string) => {
describe('AdminRoute', () => {
it('should render the admin content when user has admin role', () => {
const adminProfile: Profile = createMockProfile({ user_id: '1', role: 'admin' });
const adminProfile: Profile = createMockProfile({ role: 'admin' });
renderWithRouter(adminProfile, '/admin');
expect(screen.getByText('Admin Page Content')).toBeInTheDocument();
@@ -36,7 +36,7 @@ describe('AdminRoute', () => {
});
it('should redirect to home page when user does not have admin role', () => {
const userProfile: Profile = createMockProfile({ user_id: '2', role: 'user' });
const userProfile: Profile = createMockProfile({ role: 'user' });
renderWithRouter(userProfile, '/admin');
// The user is redirected, so we should see the home page content

View File

@@ -11,12 +11,10 @@ import { createMockUserProfile } from '../tests/utils/mockFactories';
vi.unmock('./Header');
const mockUserProfile: UserProfile = createMockUserProfile({
user_id: 'user-123',
role: 'user',
user: { user_id: 'user-123', email: 'test@example.com' },
});
const mockAdminProfile: UserProfile = createMockUserProfile({
user_id: 'admin-123',
role: 'admin',
user: { user_id: 'admin-123', email: 'admin@example.com' },
});