Files
clinicpro/assets/admin/pages/SettingsMenuPage.test.tsx
T
hamed 6ab7ed38b8 feat: refactor clinic management into a dedicated settings tab
- Removed MyClinicPage and redirected its functionality to a new ClinicDoctorsPage.
- Created ClinicDoctorsManager component for managing doctors and invitations within the settings layout.
- Updated backend permissions to allow clinic owners to detach doctors, alongside admins.
- Adjusted API documentation to reflect new permission structure.
- Updated tests to cover new functionality and permissions.
- Modified sidebar and settings menu to reflect the new structure and role-based visibility.
2026-07-17 21:56:27 +03:30

29 lines
1.3 KiB
TypeScript

import { describe, it, expect, beforeEach } from 'vitest';
import { screen } from '@testing-library/react';
import { renderWithProviders } from '../test/utils';
import SettingsMenuPage from './SettingsMenuPage';
import { menuForRole } from '../components/layout/SettingsLayout';
import { useAuthStore } from '../stores/authStore';
beforeEach(() => {
useAuthStore.setState({ primaryRole: 'doctor' });
});
describe('SettingsMenuPage', () => {
it('lists the settings sections available to the current role', () => {
renderWithProviders(<SettingsMenuPage />);
for (const item of menuForRole('doctor')) {
expect(screen.getByText(item.label)).toBeInTheDocument();
}
// clinic-only section is not shown to a doctor
expect(screen.queryByText('پزشکان کلینیک')).not.toBeInTheDocument();
});
it('links every section to its route', () => {
renderWithProviders(<SettingsMenuPage />);
expect(screen.getByText('خرید اشتراک').closest('a')).toHaveAttribute('href', '/admin/subscription');
expect(screen.getByText('مدیریت نوبت دهی').closest('a')).toHaveAttribute('href', '/admin/appointment-settings');
expect(screen.getByText('حساب کاربری').closest('a')).toHaveAttribute('href', '/admin/account-settings');
});
});