mirror of
https://github.com/immissmandy/Kitchen.git
synced 2026-07-27 12:25:30 +02:00
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { MockKitchenAiProvider } from '@/lib/ai/client';
|
|
|
|
describe('MockKitchenAiProvider (No Billing Test)', () => {
|
|
const provider = new MockKitchenAiProvider();
|
|
|
|
it('suggests recipes with expected structured outputs', async () => {
|
|
const recipes = await provider.suggestRecipes({
|
|
householdId: 'test-household',
|
|
inventory: [
|
|
{
|
|
id: 'prod-1',
|
|
householdId: 'test-household',
|
|
categoryId: null,
|
|
defaultLocationId: null,
|
|
defaultUnitId: null,
|
|
name: 'Reis',
|
|
brand: null,
|
|
description: null,
|
|
barcode: null,
|
|
imagePath: null,
|
|
packageSize: 1000,
|
|
packageUnit: 'g',
|
|
minimumQuantity: 100,
|
|
favorite: true,
|
|
preferredStore: null,
|
|
estimatedPriceCents: 249,
|
|
priceUpdatedAt: null,
|
|
archived: false,
|
|
totalQuantity: 1000,
|
|
stockValueCents: 249,
|
|
isLowStock: false,
|
|
isExpiringSoon: false,
|
|
earliestExpirationDate: null,
|
|
},
|
|
],
|
|
});
|
|
|
|
expect(recipes).toHaveLength(1);
|
|
expect(recipes[0].title).toBeDefined();
|
|
expect(recipes[0].inventoryCoveragePercent).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('returns verified price searches via Mock Provider', async () => {
|
|
const price = await provider.searchPrices({
|
|
householdId: 'test-household',
|
|
query: 'Spaghetti',
|
|
retailer: 'REWE',
|
|
});
|
|
|
|
expect(price.priceCents).toBe(189);
|
|
expect(price.confidence).toBe('HIGH');
|
|
});
|
|
});
|