Skip to content

Commit

Permalink
feat: custom render 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
eonseok-jeon committed Aug 28, 2024
1 parent eb4bb23 commit b222f7f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/tests/test-utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { render, type RenderOptions } from '@testing-library/react';
import DeviceTypeProvider from 'contexts/DeviceTypeProvider';
import RecruitingInfoProvider from 'contexts/RecruitingInfoProvider';
import ThemeProvider from 'contexts/ThemeProvider';
import type { ReactNode } from 'react';

const AllTheProviders = ({ children }: { children: ReactNode }) => {
return (
<ThemeProvider>
<DeviceTypeProvider>
<RecruitingInfoProvider>{children}</RecruitingInfoProvider>
</DeviceTypeProvider>
</ThemeProvider>
);
};

const renderWithContext = (ui: ReactNode, options: RenderOptions) =>
render(ui, { wrapper: AllTheProviders, ...options });

// re-export everything
export * from '@testing-library/react';

// override render method
export { renderWithContext as render };

0 comments on commit b222f7f

Please sign in to comment.