import { generateSchedule } from '../../utils/schedule'; import { Frequency, Medication } from '../../types'; describe('Performance: schedule generation', () => { const createMedication = (index: number): Medication => ({ _id: `med-${index}`, _rev: `1-${index}`, name: `Medication ${index}`, dosage: '10mg', frequency: Frequency.Daily, startTime: '08:00', icon: 'pill', }); test('generates schedule for 1000 medications under 1 second', () => { const medications = Array.from({ length: 1000 }, (_, idx) => createMedication(idx) ); const start = performance.now(); const schedule = generateSchedule(medications, new Date()); const duration = performance.now() - start; expect(schedule.length).toBe(medications.length); expect(duration).toBeLessThan(1000); }); });