Skip to content

Commit

Permalink
Updated failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
YulichkaR committed Jul 29, 2024
1 parent 8a461d4 commit f9215c9
Showing 1 changed file with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,48 @@ describe('PasswordSecurityTab', () => {
expect(description).toBeInTheDocument()
})

it('checks if ConfirmDialog is open when deactivate account button is clicked', () => {
it('renders title and description change password', () => {
const title = screen.getByText(
'editProfilePage.profile.passwordSecurityTab.deactivateTitle'
)
const description = screen.getByText(
'editProfilePage.profile.passwordSecurityTab.deactivateSubTitle'
)
expect(title).toBeInTheDocument()
expect(description).toBeInTheDocument()
})

it('renders title and description deactivate account', async () => {
const deactivateAccountButton = screen.getByText(
'editProfilePage.profile.passwordSecurityTab.deactivateAccount'
)

fireEvent.click(deactivateAccountButton)

const deactivateTitle = screen.getByText(
'editProfilePage.profile.passwordSecurityTab.deactivateTitle'
const deactivateDescription = screen.getByText(
'editProfilePage.profile.passwordSecurityTab.deactivateDescription'
)
expect(deactivateTitle).toBeInTheDocument()
expect(deactivateDescription).toBeInTheDocument()
})

it('checks if ConfirmDialog is closed when cancel button is clicked', async () => {
const deactivateAccountButton = screen.getByText(
'editProfilePage.profile.passwordSecurityTab.deactivateAccount'
)
let deactivateTitle
let deactivateDescription

fireEvent.click(deactivateAccountButton)

const cancelButton = screen.getByText('common.cancel')
fireEvent.click(cancelButton)

await waitForElementToBeRemoved(() => {
deactivateTitle = screen.queryByText(
'editProfilePage.profile.passwordSecurityTab.deactivateTitle'
deactivateDescription = screen.queryByText(
'editProfilePage.profile.passwordSecurityTab.deactivateDescription'
)
return deactivateTitle
return deactivateDescription
})

expect(deactivateTitle).not.toBeInTheDocument()
expect(deactivateDescription).not.toBeInTheDocument()
})
})

0 comments on commit f9215c9

Please sign in to comment.