All files / src/utils test-utils.tsx

100% Statements 13/13
100% Branches 0/0
100% Functions 2/2
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 3633x 33x 33x 33x 33x 33x 33x   33x   33x 82x                                 33x     82x     82x  
import React, { ReactElement } from 'react';
import { render, RenderOptions } from '@testing-library/react';
import { I18nProvider } from '@procore/core-react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { translations } from '../mocks/translations';
import { vendorConfigurableFieldSets } from '../mocks/vendorConfigurableFieldSets';
import { AddCompanyContextProvider } from '../Context/AddCompanyContext';
 
const queryClient = new QueryClient();
 
const AllTheProviders = ({ children }: { children: React.ReactNode }) => {
  return (
    <I18nProvider locale="en" translations={translations}>
      <QueryClientProvider client={queryClient}>
        <AddCompanyContextProvider
          companyId={1234}
          businessId="5678"
          projectId="91011"
          vendorConfigurableFieldSets={vendorConfigurableFieldSets}
          canCreateAndEditCompanies={true}
        >
          {children}
        </AddCompanyContextProvider>
      </QueryClientProvider>
    </I18nProvider>
  );
};
 
const customRender = (
  ui: ReactElement,
  options?: Omit<RenderOptions, 'wrapper'>
) => render(ui, { wrapper: AllTheProviders, ...options });
 
export * from '@testing-library/react';
export { customRender as render };