Newer
Older
import toJson from 'enzyme-to-json'
import React from 'react'
import {
createMockEcolyoStore,
mockGlobalState,
} from '../../../../tests/__mocks__/store'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
describe('StepConsent component', () => {
it('should be rendered correctly', () => {
const wrapper = mount(
<Provider store={store}>
<StepConsent
onChange={mockHandleChange}
/>
</Provider>
)
expect(toJson(wrapper)).toMatchSnapshot()
})
it('should change pdlConfirm value', () => {
const wrapper = mount(
<Provider store={store}>
<StepConsent
onChange={mockHandleChange}
/>
</Provider>
)
wrapper.find('#pdlConfirm').first().simulate('change')
expect(mockHandleChange).toHaveBeenCalledWith('pdlConfirm', false)
})
it('should change dataConsent value', () => {
const wrapper = mount(
<Provider store={store}>
<StepConsent
onChange={mockHandleChange}
/>
</Provider>
)
wrapper.find('#dataConsent').first().simulate('change')
expect(mockHandleChange).toHaveBeenCalledWith('dataConsent', false)
})
})