11import { render , screen } from '@testing-library/react' ;
22import userEvent from '@testing-library/user-event' ;
3+ import { IntlProvider } from '@edx/frontend-platform/i18n' ;
34import { ConfirmModal } from './ConfirmModal' ;
45
56describe ( 'ConfirmModal' , ( ) => {
@@ -18,24 +19,40 @@ describe('ConfirmModal', () => {
1819 } ) ;
1920
2021 it ( 'should not render content when modal is closed' , ( ) => {
21- render ( < ConfirmModal { ...props } /> ) ;
22+ render (
23+ < IntlProvider locale = "en" >
24+ < ConfirmModal { ...props } />
25+ </ IntlProvider > ,
26+ ) ;
2227 expect ( screen . queryByText ( props . content ) ) . toBeNull ( ) ;
2328 } ) ;
2429
2530 it ( 'should display content when modal is open' , ( ) => {
26- render ( < ConfirmModal { ...props } isOpen /> ) ;
31+ render (
32+ < IntlProvider locale = "en" >
33+ < ConfirmModal { ...props } isOpen />
34+ </ IntlProvider > ,
35+ ) ;
2736 expect ( screen . getByText ( props . content ) ) . toBeInTheDocument ( ) ;
2837 } ) ;
2938
3039 it ( 'should call onCancel when cancel button is clicked' , async ( ) => {
31- render ( < ConfirmModal { ...props } isOpen /> ) ;
40+ render (
41+ < IntlProvider locale = "en" >
42+ < ConfirmModal { ...props } isOpen />
43+ </ IntlProvider > ,
44+ ) ;
3245 const user = userEvent . setup ( ) ;
3346 await user . click ( screen . getByText ( props . cancelText ) ) ;
3447 expect ( props . onCancel ) . toHaveBeenCalledTimes ( 1 ) ;
3548 } ) ;
3649
3750 it ( 'should call onConfirm when confirm button is clicked' , async ( ) => {
38- render ( < ConfirmModal { ...props } isOpen /> ) ;
51+ render (
52+ < IntlProvider locale = "en" >
53+ < ConfirmModal { ...props } isOpen />
54+ </ IntlProvider > ,
55+ ) ;
3956 const user = userEvent . setup ( ) ;
4057 await user . click ( screen . getByText ( props . confirmText ) ) ;
4158 expect ( props . onConfirm ) . toHaveBeenCalledTimes ( 1 ) ;
0 commit comments