mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-11 17:05:43 +00:00
30 lines
857 B
TypeScript
30 lines
857 B
TypeScript
import React, { PropsWithChildren } from "react";
|
|
import { render, RenderOptions } from "@testing-library/react";
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
|
|
// Create a client for testing
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
retry: false,
|
|
gcTime: Infinity,
|
|
staleTime: Infinity,
|
|
refetchOnWindowFocus: false,
|
|
refetchOnReconnect: false,
|
|
refetchOnMount: false,
|
|
},
|
|
mutations: {
|
|
retry: false,
|
|
},
|
|
},
|
|
});
|
|
|
|
const Providers: React.FC<PropsWithChildren> = ({ children }) => {
|
|
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
|
|
};
|
|
|
|
export const renderWithProviders = (ui: React.ReactElement, options?: RenderOptions) =>
|
|
render(ui, { wrapper: Providers, ...options });
|
|
|
|
export * from "@testing-library/react";
|