- Add accessibility tests for ResetPasswordPage component - Add performance tests for schedule generation - Add visual regression tests with snapshot baselines - Establish testing patterns for UI accessibility compliance - Include performance benchmarks for core utilities
27 lines
836 B
TypeScript
27 lines
836 B
TypeScript
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);
|
|
});
|
|
});
|