Skip to content
Snippets Groups Projects
Commit e2e19902 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

test(rtl): feedback

parent fe79cdb8
No related branches found
No related tags found
2 merge requests!10622.7 Release,!1048test(rtl): feedback
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import FeedbackModal from 'components/Feedback/FeedbackModal'
import { mount } from 'enzyme'
import toJson from 'enzyme-to-json'
......@@ -35,34 +37,33 @@ describe('FeedbackModal component', () => {
describe('FeedbackModal functionalities', () => {
it('should close modal with the "x" button', async () => {
const wrapper = mount(
render(
<Provider store={store}>
<FeedbackModal />
</Provider>
)
wrapper.find('.modal-paper-close-button').first().simulate('click')
await userEvent.click(screen.getAllByRole('button')[0])
expect(mockAppDispatch).toHaveBeenCalledTimes(1)
})
it('should close modal with the "later" button', async () => {
const wrapper = mount(
render(
<Provider store={store}>
<FeedbackModal />
</Provider>
)
wrapper.find('.btnSecondary').first().simulate('click')
await userEvent.click(screen.getAllByRole('button')[1])
expect(mockAppDispatch).toHaveBeenCalledTimes(1)
})
it('should open the SAU link', () => {
it('should open the SAU link', async () => {
global.open = jest.fn()
const wrapper = mount(
render(
<Provider store={store}>
<FeedbackModal />
</Provider>
)
wrapper.find('.btnPrimary').first().simulate('click')
await userEvent.click(screen.getAllByRole('button')[2])
expect(window.open).toHaveBeenCalledTimes(1)
expect(global.open).toHaveBeenCalledWith(`${__SAU_LINK__}?version=0.0.0`)
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment