import { describe, it, expect } from 'vitest' import { server, http, HttpResponse } from './test-setup' import { parseIngredients, parseRecipe } from '@/api/sdk' describe('parse api errors', () => { it('returns 422 for invalid ingredient lines', async () => { server.use( http.get('*/api/v1/recipes/ingredients/parse', () => new HttpResponse(null, { status: 422 })) ) await expect(parseIngredients([''])).rejects.toBeTruthy() }) it('returns 422 for invalid recipe URL', async () => { server.use( http.get('*/api/v1/recipes/parse', () => new HttpResponse(null, { status: 422 })) ) await expect(parseRecipe('not-a-url')).rejects.toBeTruthy() }) })