import { ReactElement } from "react";
import { render, RenderOptions } from "@testing-library/react";
import { Providers } from "./components/Providers";
import { AuthProvider } from "./auth-context";

function AllProviders({ children }: { children: React.ReactNode }) {
  return (
    <Providers>
      <AuthProvider>{children}</AuthProvider>
    </Providers>
  );
}

export function renderWithProviders(ui: ReactElement, options?: Omit<RenderOptions, "wrapper">) {
  return render(ui, { wrapper: AllProviders, ...options });
}
