Files
clinicpro/assets/admin/lib/displayDoctorName.test.ts
T
hamed 74577c2ff6 feat: unify doctor title handling and enhance specialty selection
- Implemented a helper function `displayDoctorName` to prepend "دکتر" to doctor names for consistent display across the application.
- Updated various components (InviteDoctorModal, DashboardPage, DoctorDetailPage, DoctorsPage, etc.) to utilize the new helper for rendering doctor names.
- Modified the DoctorFormPage to automatically add the "دکتر" title in the UI without requiring user input.
- Fixed the EditSpecialtyPicker component to allow multiple specialty selections, resolving a UI bug where only one specialty could be selected at a time.
- Ensured that the backend strips the "دکتر" title from the name during pre-registration and doctor creation processes.
- Added tests for the new functionality, including checks for title handling and specialty selection logic.
- Updated API documentation to reflect changes in name handling and display logic.
2026-07-19 19:57:03 +03:30

24 lines
910 B
TypeScript

import { describe, it, expect } from 'vitest';
import { displayDoctorName } from './utils';
describe('displayDoctorName', () => {
it('prepends the title to a bare name', () => {
expect(displayDoctorName('حامد حسینی')).toBe('دکتر حامد حسینی');
});
it('does not double the title when the name already starts with it', () => {
expect(displayDoctorName('دکتر حامد حسینی')).toBe('دکتر حامد حسینی');
});
it('trims surrounding whitespace before deciding', () => {
expect(displayDoctorName(' حامد حسینی ')).toBe('دکتر حامد حسینی');
});
it('returns empty string for empty/nullish input (no lone «دکتر»)', () => {
expect(displayDoctorName('')).toBe('');
expect(displayDoctorName(null)).toBe('');
expect(displayDoctorName(undefined)).toBe('');
expect(displayDoctorName(' ')).toBe('');
});
});