more unit test fixes + some integration
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h21m56s

This commit is contained in:
2025-12-21 14:54:41 -08:00
parent 0cf4ca02b7
commit 15f759cbc4
44 changed files with 836 additions and 150 deletions

View File

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