aboutsummaryrefslogtreecommitdiffstats
path: root/__tests__/utils/test-utils.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-03-29 19:40:39 +0200
committerArmand Philippot <git@armandphilippot.com>2022-03-29 19:41:59 +0200
commit6fee897c23b87228a31879a22fc778dec1c0bb92 (patch)
tree846543da630199df4f4627bcfca8d4d86b78fda6 /__tests__/utils/test-utils.tsx
parentfd3e0cb88f5dbcac0a1b16b14654bf8d343e5adc (diff)
test(jest): add a test for Branding component
Diffstat (limited to '__tests__/utils/test-utils.tsx')
-rw-r--r--__tests__/utils/test-utils.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/__tests__/utils/test-utils.tsx b/__tests__/utils/test-utils.tsx
index e47bbe1..00123c3 100644
--- a/__tests__/utils/test-utils.tsx
+++ b/__tests__/utils/test-utils.tsx
@@ -1,6 +1,6 @@
import { render, RenderOptions } from '@testing-library/react';
import { ThemeProvider } from 'next-themes';
-import { FC } from 'react';
+import { FC, ReactElement } from 'react';
import { IntlProvider } from 'react-intl';
type ProvidersConfig = {
@@ -8,8 +8,8 @@ type ProvidersConfig = {
};
type CustomRenderOptions = {
- providers: ProvidersConfig;
- testingLibrary: Omit<RenderOptions, 'wrapper'>;
+ providers?: ProvidersConfig;
+ testingLibrary?: Omit<RenderOptions, 'wrapper'>;
};
/**
@@ -28,13 +28,13 @@ const AllTheProviders: FC<ProvidersConfig> = ({ children, locale = 'en' }) => {
/**
* Render a component with all the providers.
*
- * @param {JSX.Element} ui - A React component.
+ * @param {ReactElement} ui - A React component.
* @param {CustomRenderOptions} [options] - An object of render options and providers options.
* @returns A React component wrapped with all the providers.
*/
-const customRender = (ui: JSX.Element, options?: CustomRenderOptions) =>
+const customRender = (ui: ReactElement, options?: CustomRenderOptions) =>
render(ui, {
- wrapper: () => <AllTheProviders {...options?.providers} />,
+ wrapper: (props) => <AllTheProviders {...props} {...options?.providers} />,
...options?.testingLibrary,
});