Newer
Older

Guilhem CARRON
committed
import { mount } from 'enzyme'
import toJson from 'enzyme-to-json'

Guilhem CARRON
committed
import DeleteGRDFAccountModal from './DeleteGRDFAccountModal'
describe('DeleteGRDFAccountModal component', () => {
it('should be rendered correctly', () => {
const component = mount(
<DeleteGRDFAccountModal
open={true}
handleCloseClick={jest.fn()}
deleteAccount={jest.fn()}
/>
)
expect(toJson(component)).toMatchSnapshot()
})
it('should launch the deletion process and close modal', () => {
const mockDelete = jest.fn()
const mockClose = jest.fn()
const component = mount(
<DeleteGRDFAccountModal
open={true}
handleCloseClick={mockClose}
deleteAccount={mockDelete}
/>
)
component.find(Button).at(1).simulate('click')

Guilhem CARRON
committed
expect(mockDelete).toHaveBeenCalledTimes(1)
})
})