2026-05-14 14:47:23 +09:00
|
|
|
import { describe, it, expect, vi } from 'vitest';
|
2026-05-19 11:06:03 +09:00
|
|
|
import { NoOpLlmProvider } from '../../../src/modules/llm/no-op-llm.provider.js';
|
|
|
|
|
import { LLM_PROVIDER } from '../../../src/modules/llm/llm-provider.interface.js';
|
2026-05-14 14:47:23 +09:00
|
|
|
|
|
|
|
|
describe(NoOpLlmProvider.name, () => {
|
|
|
|
|
const provider = new NoOpLlmProvider();
|
|
|
|
|
|
|
|
|
|
it('exports LLM_PROVIDER symbol', () => {
|
|
|
|
|
expect(typeof LLM_PROVIDER).toBe('symbol');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('extractNutrition returns null and warns', async () => {
|
|
|
|
|
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
|
|
|
const result = await provider.extractNutrition({ text: 'apple' });
|
|
|
|
|
expect(result).toBeNull();
|
|
|
|
|
expect(spy).toHaveBeenCalledWith(expect.stringContaining('extractNutrition'));
|
|
|
|
|
spy.mockRestore();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('parseRecipe returns null and warns', async () => {
|
|
|
|
|
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
|
|
|
const result = await provider.parseRecipe('pasta recipe');
|
|
|
|
|
expect(result).toBeNull();
|
|
|
|
|
expect(spy).toHaveBeenCalledWith(expect.stringContaining('parseRecipe'));
|
|
|
|
|
spy.mockRestore();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('parseRecipeFromUrl returns null and warns', async () => {
|
|
|
|
|
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
|
|
|
const result = await provider.parseRecipeFromUrl('https://example.com');
|
|
|
|
|
expect(result).toBeNull();
|
|
|
|
|
expect(spy).toHaveBeenCalledWith(expect.stringContaining('parseRecipeFromUrl'));
|
|
|
|
|
spy.mockRestore();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('parseReceipt returns null and warns', async () => {
|
|
|
|
|
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
|
|
|
const result = await provider.parseReceipt(Buffer.from('fake-image'));
|
|
|
|
|
expect(result).toBeNull();
|
|
|
|
|
expect(spy).toHaveBeenCalledWith(expect.stringContaining('parseReceipt'));
|
|
|
|
|
spy.mockRestore();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('suggestMealPlan returns null and warns', async () => {
|
|
|
|
|
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
|
|
|
const result = await provider.suggestMealPlan({ householdId: 'hh1' });
|
|
|
|
|
expect(result).toBeNull();
|
|
|
|
|
expect(spy).toHaveBeenCalledWith(expect.stringContaining('suggestMealPlan'));
|
|
|
|
|
spy.mockRestore();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('parseNaturalLanguage returns null and warns', async () => {
|
|
|
|
|
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
|
|
|
const result = await provider.parseNaturalLanguage('add milk');
|
|
|
|
|
expect(result).toBeNull();
|
|
|
|
|
expect(spy).toHaveBeenCalledWith(expect.stringContaining('parseNaturalLanguage'));
|
|
|
|
|
spy.mockRestore();
|
|
|
|
|
});
|
|
|
|
|
});
|