Cleanup after initial plan

This commit is contained in:
Aerilyn Weber 2026-05-19 10:13:40 +09:00
parent d2a7e652b3
commit 245520fb50
53 changed files with 6733 additions and 621 deletions

View file

@ -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);
});
});
});