dry-wash-pl/__mocks__/server/handlers.ts

20 lines
543 B
TypeScript
Raw Normal View History

2025-02-15 19:45:37 +03:00
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
});
})
];