Cleanup after initial plan
This commit is contained in:
parent
d2a7e652b3
commit
245520fb50
53 changed files with 6733 additions and 621 deletions
|
|
@ -111,7 +111,13 @@ describe('prices.routes', () => {
|
|||
|
||||
describe('POST /api/v1/households/:householdId/prices', () => {
|
||||
it('records price and returns 201 response', async () => {
|
||||
mockCreate.mockResolvedValue(makeRecord());
|
||||
mockCreate.mockResolvedValue(
|
||||
makeRecord({
|
||||
receiptImageUrl: 'http://test.com/img.jpg',
|
||||
notes: 'Custom notes',
|
||||
date: '2026-05-14T00:00:00.000Z',
|
||||
})
|
||||
);
|
||||
|
||||
const res = await app.inject({
|
||||
method: 'POST',
|
||||
|
|
@ -179,4 +185,34 @@ describe('prices.routes', () => {
|
|||
expect(typeof body.priceAlerts[0].date).toBe('string');
|
||||
});
|
||||
});
|
||||
|
||||
describe('POST /api/v1/households/:householdId/prices/bulk', () => {
|
||||
it('records bulk prices and returns 201', async () => {
|
||||
mockCreateMany.mockResolvedValue([makeRecord()]);
|
||||
const res = await app.inject({
|
||||
method: 'POST',
|
||||
url: '/api/v1/households/hh1/prices/bulk',
|
||||
headers: { ...authHeaders, 'content-type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
storeId: 's1',
|
||||
items: [{ productId: 'p1', price: 10, quantity: 1, unit: 'piece' }],
|
||||
}),
|
||||
});
|
||||
expect(res.statusCode).toBe(201);
|
||||
expect(res.json()[0].productName).toBe('Apples');
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /api/v1/households/:householdId/prices/compare/:productId', () => {
|
||||
it('returns comparison array', async () => {
|
||||
mockCompareStores.mockResolvedValue([{ storeId: 's1', storeName: 'Store', latestPrice: 10, latestPricePerUnit: 10, currency: 'USD', date: new Date() }]);
|
||||
const res = await app.inject({
|
||||
method: 'GET',
|
||||
url: '/api/v1/households/hh1/prices/compare/p1',
|
||||
headers: authHeaders,
|
||||
});
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.json().data).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue