Phase 5 cleanup
This commit is contained in:
parent
5536acd67d
commit
76a516a417
136 changed files with 6322 additions and 1985 deletions
|
|
@ -38,7 +38,12 @@ describe(PurchasesService.name, () => {
|
|||
});
|
||||
|
||||
const fakeStore = { _id: 'st-1', name: 'CVS' };
|
||||
const fakeProduct = { _id: 'mp-1', medicineId: 'med-1', medicineName: 'Ibuprofen', brand: 'Advil' };
|
||||
const fakeProduct = {
|
||||
_id: 'mp-1',
|
||||
medicineId: 'med-1',
|
||||
medicineName: 'Ibuprofen',
|
||||
brand: 'Advil',
|
||||
};
|
||||
|
||||
describe('create', () => {
|
||||
const validInput = {
|
||||
|
|
@ -165,7 +170,9 @@ describe(PurchasesService.name, () => {
|
|||
it('throws NotFoundError when purchase not found', async () => {
|
||||
mockPurchasesRepo.findById.mockResolvedValue(null);
|
||||
|
||||
await expect(service.receive('missing', 'hh1', 'user-1')).rejects.toThrow('Purchase not found');
|
||||
await expect(service.receive('missing', 'hh1', 'user-1')).rejects.toThrow(
|
||||
'Purchase not found',
|
||||
);
|
||||
});
|
||||
|
||||
it('throws BadRequestError when status is not ordered', async () => {
|
||||
|
|
@ -309,7 +316,14 @@ describe(PurchasesService.name, () => {
|
|||
storeName: 'CVS',
|
||||
purchasedAt: new Date(),
|
||||
items: [
|
||||
{ medicineProductId: 'mp-1', medicineId: 'med-1', name: 'X', quantity: 10, unit: 'tablet', addedToCabinet: true },
|
||||
{
|
||||
medicineProductId: 'mp-1',
|
||||
medicineId: 'med-1',
|
||||
name: 'X',
|
||||
quantity: 10,
|
||||
unit: 'tablet',
|
||||
addedToCabinet: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
mockPurchasesRepo.findById.mockResolvedValue(purchase);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue