Files
salona/tests/test-utils.tsx
farnoosh-krm cf568fd39b test: add comprehensive test coverage for multiple
components

(fix) - Add new test files for:
  • ActiveAccounts
  • AddService
  • CreateGiftCard
  • CustomerCard
  • CustomerCards
  • DeleteButton
  • EditButton
  • LoyaltyCardListItem
  • MapPicker
  • Services
  • ServicesQA
(fix) - Add axios interceptor mock
(fix) - Add importMetaEnv mock
(fix) - Add environment setup file for test environment
2026-04-12 19:13:00 +03:30

35 lines
1.1 KiB
TypeScript

// import { ReactElement } from 'react';
// import { render, RenderOptions } from '@testing-library/react';
// import { MemoryRouter } from 'react-router-dom';
// interface ExtendedRenderOptions extends Omit<RenderOptions, 'queries'> {
// route?: string;
// }
// export function renderWithProviders(ui: ReactElement, options?: ExtendedRenderOptions) {
// const { route = '/', ...renderOptions } = options ?? {};
// return render(<MemoryRouter initialEntries={[route]}>{ui}</MemoryRouter>, renderOptions);
// }
// // Re-export everything
// export * from '@testing-library/react';
// export { default as userEvent } from '@testing-library/user-event';
import { ReactElement } from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';
export function renderWithProviders(ui: ReactElement) {
const queryClient = new QueryClient();
return render(
<QueryClientProvider client={queryClient}>
<BrowserRouter>
{ui}
</BrowserRouter>
</QueryClientProvider>
);
}