Cleanup after initial plan
This commit is contained in:
parent
d2a7e652b3
commit
245520fb50
53 changed files with 6733 additions and 621 deletions
|
|
@ -91,4 +91,19 @@ describe(NutritionTargetRepository.name, () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('update', () => {
|
||||
it('updates specific target using findOneAndUpdate', async () => {
|
||||
const updatedDoc = { _id: 't1', dailyCalories: 2100 };
|
||||
vi.mocked(NutritionTargetModel.findOneAndUpdate).mockReturnValue(makeChain(updatedDoc) as never);
|
||||
|
||||
const result = await repo.update('t1', 'user1', 'hh1', { dailyCalories: 2100 });
|
||||
expect(NutritionTargetModel.findOneAndUpdate).toHaveBeenCalledWith(
|
||||
{ _id: 't1', userId: 'user1', householdId: 'hh1' },
|
||||
{ $set: { dailyCalories: 2100 } },
|
||||
{ new: true, lean: true }
|
||||
);
|
||||
expect(result).toEqual(updatedDoc);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue