// import { ReactElement } from 'react';
// import { render, RenderOptions } from '@testing-library/react';
// import { MemoryRouter } from 'react-router-dom';

// interface ExtendedRenderOptions extends Omit<RenderOptions, 'queries'> {
//   route?: string;
// }

// export function renderWithProviders(ui: ReactElement, options?: ExtendedRenderOptions) {
//   const { route = '/', ...renderOptions } = options ?? {};
//   return render(<MemoryRouter initialEntries={[route]}>{ui}</MemoryRouter>, renderOptions);
// }

// // Re-export everything
// export * from '@testing-library/react';
// export { default as userEvent } from '@testing-library/user-event';


import { ReactElement } from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';

export function renderWithProviders(ui: ReactElement) {
  const queryClient = new QueryClient();

  return render(
    <QueryClientProvider client={queryClient}>
      <BrowserRouter>
        {ui}
      </BrowserRouter>
    </QueryClientProvider>
  );
}
