Tests refactor
This commit is contained in:
parent
245520fb50
commit
99134d8556
165 changed files with 911 additions and 531 deletions
|
|
@ -1,59 +0,0 @@
|
|||
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