feat: added custom render function for react testing library

so we can load our own providers
pull/3083/head
William Grant 11 months ago
parent 3f3c2f92ed
commit 1d5c2de531

@ -0,0 +1,19 @@
/* eslint-disable import/no-extraneous-dependencies */
import { render, RenderOptions } from '@testing-library/react';
import { AnimatePresence } from 'framer-motion';
import { ReactElement, ReactNode } from 'react';
import { SessionTheme } from '../../themes/SessionTheme';
const Providers = ({ children }: { children: ReactNode }) => {
return (
<SessionTheme>
<AnimatePresence>{children}</AnimatePresence>
</SessionTheme>
);
};
const renderComponent = (ui: ReactElement, options?: Omit<RenderOptions, 'wrapper'>) =>
render(ui, { wrapper: Providers, ...options });
export * from '@testing-library/react';
export { renderComponent };
Loading…
Cancel
Save