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(''); }); });