Skip to content
Snippets Groups Projects
EcogestureSelectionModal.spec.tsx 875 B
Newer Older
  • Learn to ignore specific revisions
  • import { render, screen } from '@testing-library/react'
    
    import userEvent from '@testing-library/user-event'
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    import React from 'react'
    
    import EcogestureSelectionModal from './EcogestureSelectionModal'
    
    const mockHandleClose = jest.fn()
    describe('EcogestureInitModal component', () => {
      it('should be rendered correctly', () => {
    
        const { baseElement } = render(
    
          <EcogestureSelectionModal
            open={true}
            handleCloseClick={mockHandleClose}
          />
        )
    
        expect(baseElement).toMatchSnapshot()
    
      })
    
      it('should close modal and update profile', async () => {
    
          <EcogestureSelectionModal
            open={true}
            handleCloseClick={mockHandleClose}
          />
        )
    
        await userEvent.click(
          screen.getByText('ecogesture_selection.selectionModal.button_close')
        )
    
        expect(mockHandleClose).toHaveBeenCalledTimes(1)
      })
    })