import React from 'react';

import { ThemeProvider } from '@emotion/react';
import { render as rntlRender, RenderAPI } from '@testing-library/react-native';

import { theme } from '@/app/shared/theme/index';

export const render = (
  component: React.ReactElement<unknown>
): RenderAPI => {
  const TestProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
    return (
      <ThemeProvider theme={theme}>
        {children}
      </ThemeProvider>
    )
  };

  return rntlRender(component, { wrapper: TestProvider });
};
