arbret/frontend/app/test-utils.tsx

17 lines
529 B
TypeScript
Raw Normal View History

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 });
}