16 lines
589 B
JavaScript
16 lines
589 B
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import { server, http, HttpResponse } from './test-setup'
|
|
import { parseRecipe } from '@/api/sdk'
|
|
import { setHouseholdSlugProvider } from '@/api/client'
|
|
|
|
describe('parse api errors', () => {
|
|
it('rejects when recipe URL invalid (scoped)', async () => {
|
|
setHouseholdSlugProvider(() => 'the-smiths')
|
|
server.use(
|
|
http.post('*/api/v1/households/the-smiths/recipes/parse-from-url', () => {
|
|
return new HttpResponse(null, { status: 422 })
|
|
})
|
|
)
|
|
await expect(parseRecipe('not-a-url')).rejects.toBeTruthy()
|
|
})
|
|
})
|