import { describe, it, expect } from 'vitest'; import { formatLifeDateRange } from './personLifeDates'; describe('formatLifeDateRange', () => { it('returns both dates when birth and death year are given', () => { expect(formatLifeDateRange(1882, 1944)).toBe('* 1882 – † 1944'); }); it('returns only birth year when only birthYear is given', () => { expect(formatLifeDateRange(1882, undefined)).toBe('* 1882'); }); it('returns only death year when only deathYear is given', () => { expect(formatLifeDateRange(undefined, 1944)).toBe('† 1944'); }); it('returns empty string when neither year is given', () => { expect(formatLifeDateRange(undefined, undefined)).toBe(''); }); it('returns empty string when both are null', () => { expect(formatLifeDateRange(null, null)).toBe(''); }); });