reactTestingLibrary.tsx 627 B

1234567891011121314151617181920
  1. import {cache} from '@emotion/css';
  2. import {CacheProvider, ThemeProvider} from '@emotion/react';
  3. import {render, RenderOptions} from '@testing-library/react';
  4. import {lightTheme} from 'app/utils/theme';
  5. const AllTheProviders = ({children}: {children?: React.ReactNode}) => {
  6. return (
  7. <CacheProvider value={cache}>
  8. <ThemeProvider theme={lightTheme}>{children}</ThemeProvider>
  9. </CacheProvider>
  10. );
  11. };
  12. const mountWithTheme = (ui: React.ReactElement, options?: RenderOptions) => {
  13. return render(ui, {wrapper: AllTheProviders, ...options});
  14. };
  15. export * from '@testing-library/react';
  16. export {mountWithTheme};