more unit test fixes + some integration
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h21m56s
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h21m56s
This commit is contained in:
@@ -6,7 +6,7 @@ import { http, HttpResponse } from 'msw';
|
||||
// Ensure the module under test is NOT mocked.
|
||||
vi.unmock('./aiApiClient');
|
||||
|
||||
import { createMockFlyerItem, createMockStore } from '../tests/utils/mockFactories';
|
||||
import { createMockFlyerItem, createMockStore, createMockMasterGroceryItem } from '../tests/utils/mockFactories';
|
||||
import * as aiApiClient from './aiApiClient';
|
||||
|
||||
// 1. Mock logger to keep output clean
|
||||
@@ -387,4 +387,17 @@ describe('AI API Client (Network Mocking with MSW)', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('compareWatchedItemPrices', () => {
|
||||
it('should send items as JSON in the body', async () => {
|
||||
const items = [createMockMasterGroceryItem({ name: 'apple' })];
|
||||
await aiApiClient.compareWatchedItemPrices(items);
|
||||
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
const req = requestSpy.mock.calls[0][0];
|
||||
|
||||
expect(req.endpoint).toBe('compare-prices');
|
||||
expect(req.body).toEqual({ items });
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user