feat: setup tests env (#85)

This commit is contained in:
RustamRu
2025-02-15 19:45:37 +03:00
parent b2a067a644
commit 88242c5681
12 changed files with 15555 additions and 15263 deletions

View File

@@ -0,0 +1,20 @@
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
});
})
];

View File

@@ -0,0 +1,5 @@
import { setupServer } from 'msw/node';
import { handlers } from './handlers';
export const server = setupServer(...handlers);