Implement stores and refills, improve testing
This commit is contained in:
parent
9f416903ef
commit
5536acd67d
137 changed files with 21218 additions and 221 deletions
|
|
@ -135,6 +135,30 @@ describe(MedicinesService.name, () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('uses current name when name not provided in update', async () => {
|
||||
mockRepo.findById.mockResolvedValue({
|
||||
_id: 'med-1',
|
||||
name: 'Aspirin',
|
||||
strength: 500,
|
||||
strengthUnit: StrengthUnit.MG,
|
||||
form: MedicineForm.TABLET,
|
||||
});
|
||||
mockRepo.findDuplicate.mockResolvedValue(null);
|
||||
mockRepo.update.mockResolvedValue({ _id: 'med-1', name: 'Aspirin', strength: 250 });
|
||||
|
||||
const result = await service.update('med-1', 'hh1', { strength: 250 });
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
expect(mockRepo.findDuplicate).toHaveBeenCalledWith(
|
||||
'hh1',
|
||||
'Aspirin',
|
||||
250,
|
||||
StrengthUnit.MG,
|
||||
MedicineForm.TABLET,
|
||||
'med-1',
|
||||
);
|
||||
});
|
||||
|
||||
it('skips dedup check when no identity fields change', async () => {
|
||||
mockRepo.findById.mockResolvedValue({ _id: 'med-1', name: 'Aspirin' });
|
||||
mockRepo.update.mockResolvedValue({ _id: 'med-1', notes: 'Updated notes' });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue