import { createHttpError } from '@wix/yoshi-flow-bm';

export const createHttpErrorMock = ({
  code = 'ERR_NETWORK',
  status = 429,
  requestId,
}: {
  code?: string;
  status?: number;
  requestId?: string;
}) =>
  createHttpError({
    response: {
      data: { details: { applicationError: { code } } },
      status,
      statusText: 'ERROR',
      headers: {
        'x-wix-request-id': requestId,
      },
      config: {},
    },
    config: {},
    toJSON: () => {
      return {};
    },
    name: '',
    message: '',
    __CANCEL__: false,
  });
