Full tests coverage

This commit is contained in:
Aerilyn Weber 2026-05-19 14:09:03 +09:00
parent 99134d8556
commit 02d782c3da
157 changed files with 1074 additions and 34670 deletions

View file

@ -176,6 +176,26 @@ describe(RefillsService.name, () => {
expect(result).toHaveLength(0);
});
it('handles zero dailyConsumption gracefully in daysUntilEmptyWithOrders calculation', async () => {
mockRegimensService.calculateBurnRates.mockResolvedValue([
{
medicineId: 'med-1',
medicineName: 'Aspirin',
dailyConsumption: 0,
totalInCabinet: 10,
daysUntilEmpty: 2,
},
]);
mockCabinetRepo.getAggregateSummary.mockResolvedValue([]);
mockPricesRepo.getLatestForMedicine.mockResolvedValue(null);
mockPricesRepo.compareStores.mockResolvedValue([]);
const result = await service.getAlerts('hh1', 'user-1', 7);
expect(result).toHaveLength(1);
expect(result[0].daysUntilEmptyWithOrders).toBeNull();
});
});
describe('createList', () => {