4469fc42af
- Extract detectAuthAnomalies + THRESHOLDS from route.ts to detect.ts (Next.js rejects non-standard exports from route files) - Add explicit RenderResult return type to test-utils customRender - Skip ESLint during next build (runs separately via pnpm lint) - Revert test file exclusions from tsconfig (breaks eslint parser) - Update route.test.ts imports to match new file structure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
827 B
TypeScript
25 lines
827 B
TypeScript
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { render, type RenderOptions, type RenderResult } from "@testing-library/react";
|
|
import type { ReactElement } from "react";
|
|
|
|
function createTestQueryClient() {
|
|
return new QueryClient({
|
|
defaultOptions: {
|
|
queries: { retry: false, gcTime: 0 },
|
|
mutations: { retry: false },
|
|
},
|
|
});
|
|
}
|
|
|
|
function TestProviders({ children }: { children: React.ReactNode }) {
|
|
const queryClient = createTestQueryClient();
|
|
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
|
|
}
|
|
|
|
function customRender(ui: ReactElement, options?: Omit<RenderOptions, "wrapper">): RenderResult {
|
|
return render(ui, { wrapper: TestProviders, ...options });
|
|
}
|
|
|
|
export * from "@testing-library/react";
|
|
export { customRender as render };
|