import { screen, configure, render, waitFor } from '@testing-library/react'; import { FeedbackSectionProps } from '~/components/FeedbackSection/components/FeedbackForm'; import { lazyLoad, LazyLoadArguments } from '../lazy'; configure({ testIdAttribute: 'data-test' }); const MockOnBack = jest.fn; const MockOnClose = jest.fn; const MockOnSubmit = jest.fn; const FallbackComponent =
; const FeedbackSection = lazyLoad( () => import('~/components/FeedbackSection/components/BugRFEForm'), ); describe('lazy component loading test', () => { it('should render fallback component by default', () => { render( , ); expect(screen.getByTestId('lazy-fallback-component')).toBeInTheDocument(); }); it('should render lazy component', async () => { render( , ); await waitFor(() => { expect(screen.getByTestId('bug-rfe-form')).toBeInTheDocument(); }); }); });