import { http, delay, HttpResponse } from 'msw'; import OrderPendingMock from '../../stubs/json/landing-order-view/id1-success-pending.json'; import OrderErrorMock from '../../stubs/json/landing-order-view/id1-error.json'; export const handlers = [ http.get('/api/order/:id', async ({ params }) => { await delay(); const { id } = params; if (id === 'id1') { return HttpResponse.json(OrderPendingMock); } return new HttpResponse(null, { status: 500, statusText: OrderErrorMock.message }); }) ];