13 lines
475 B
JavaScript
13 lines
475 B
JavaScript
|
|
import { describe, it, expect } from 'vitest'
|
||
|
|
import { server, http, HttpResponse } from './test-setup'
|
||
|
|
import { purchaseShoppingList } from '@/api/sdk'
|
||
|
|
|
||
|
|
describe('shopping api (errors)', () => {
|
||
|
|
it('propagates errors on purchase failure', async () => {
|
||
|
|
server.use(
|
||
|
|
http.post('*/api/v1/shopping', () => new HttpResponse(null, { status: 422 }))
|
||
|
|
)
|
||
|
|
await expect(purchaseShoppingList([{ type: 'existing', id: 1, personId: 42 }])).rejects.toBeTruthy()
|
||
|
|
})
|
||
|
|
})
|