diff --git a/src/components/CheckIn/CheckInModal.tsx b/src/components/CheckIn/CheckInModal.tsx index 3f15824ecd..3a7813f4c9 100644 --- a/src/components/CheckIn/CheckInModal.tsx +++ b/src/components/CheckIn/CheckInModal.tsx @@ -80,7 +80,7 @@ export const CheckInModal = (props: InterfaceModalProp): JSX.Element => { size="lg" > - + Event Check In Management diff --git a/src/components/CheckIn/CheckInWrapper.test.tsx b/src/components/CheckIn/CheckInWrapper.test.tsx index 9cb7fef4ba..a7c6a2025f 100644 --- a/src/components/CheckIn/CheckInWrapper.test.tsx +++ b/src/components/CheckIn/CheckInWrapper.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { fireEvent, render, waitFor } from '@testing-library/react'; +import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import { MockedProvider } from '@apollo/react-testing'; import { CheckInWrapper } from './CheckInWrapper'; import { BrowserRouter } from 'react-router-dom'; @@ -21,7 +21,7 @@ describe('Testing CheckIn Wrapper', () => { }; test('The button to open and close the modal should work properly', async () => { - const { queryByText } = render( + render( @@ -37,22 +37,19 @@ describe('Testing CheckIn Wrapper', () => { ); // Open the modal - fireEvent.click(queryByText('Check In Registrants') as Element); + fireEvent.click(screen.getByLabelText('checkInRegistrants') as Element); await waitFor(() => - expect(queryByText('Event Check In Management')).toBeInTheDocument() + expect(screen.queryByTestId('modal-title')).toBeInTheDocument() ); - /* - TODO - The following test of closing the modal should be uncommented when the memory leak issue of MUI Data Grid is fixed. - - It will consequently ensure 100% coverage of the file. - */ - // Close the modal - // fireEvent.click(queryByRole('button', { name: /close/i }) as HTMLElement); - // await waitFor(() => - // expect(queryByText('Event Check In Management')).not.toBeInTheDocument() - // ); + // Close the modal + const closebtn = screen.getByLabelText('Close'); + + fireEvent.click(closebtn as Element); + + await waitFor(() => + expect(screen.queryByTestId('modal-title')).not.toBeInTheDocument() + ); }); });