Phases 6-7
This commit is contained in:
parent
76a516a417
commit
029940b079
111 changed files with 17247 additions and 447 deletions
59
packages/api/src/modules/llm/no-op-llm.provider.test.ts
Normal file
59
packages/api/src/modules/llm/no-op-llm.provider.test.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { NoOpLlmProvider } from './no-op-llm.provider.js';
|
||||
import { LLM_PROVIDER } from './llm-provider.interface.js';
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue