litellm/ui/litellm-dashboard/tests/test-utils.tsx
Yuneng Jiang 2e492f5cb7
fix(ui): hide guardrail group headers when only one group has entries
The team settings guardrails dropdown always rendered the Global and
Other headers, so a proxy with no global guardrails showed an empty
Global heading above the list.
2026-07-18 16:27:59 -07:00

29 lines
872 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
export const testQueryClient = 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={testQueryClient}>{children}</QueryClientProvider>;
};
export const renderWithProviders = (ui: React.ReactElement, options?: RenderOptions) =>
render(ui, { wrapper: Providers, ...options });
export * from "@testing-library/react";