import { setupServer } from 'msw/node';
import { api, handlers } from './handlers';
import { rest } from 'msw';

// Setup requests interception using the given handlers.
export const server = setupServer(...handlers);

export function mockFailureResponse() {
  // Mock failure request in msw
  server.use(
    rest.all(api('/*'), (req, res, ctx) => {
      return res(ctx.status(500), ctx.json({ message: 'Mock Internal server error' }));
    })
  );
}
