Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: change own password confirmation (#3894)
- Loading branch information
Showing
9 changed files
with
139 additions
and
13 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
frontend/src/component/user/Profile/PasswordTab/PasswordTab.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { screen } from '@testing-library/react'; | ||
import { render } from 'utils/testRenderer'; | ||
import { testServerRoute, testServerSetup } from 'utils/testServer'; | ||
import { PasswordTab } from './PasswordTab'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { UIProviderContainer } from '../../../providers/UIProvider/UIProviderContainer'; | ||
|
||
const server = testServerSetup(); | ||
testServerRoute(server, '/api/admin/ui-config', {}); | ||
testServerRoute(server, '/api/admin/auth/simple/settings', { | ||
disabled: false, | ||
}); | ||
testServerRoute(server, '/api/admin/user/change-password', {}, 'post', 401); | ||
testServerRoute(server, '/auth/reset/validate-password', {}, 'post'); | ||
|
||
test('should render authorization error on missing old password', async () => { | ||
const user = userEvent.setup(); | ||
|
||
render( | ||
<UIProviderContainer> | ||
<PasswordTab /> | ||
</UIProviderContainer> | ||
); | ||
|
||
await screen.findByText('Change password'); | ||
const passwordInput = await screen.findByLabelText('Password'); | ||
await user.clear(passwordInput); | ||
await user.type(passwordInput, 'IAmThePass1!@'); | ||
|
||
const confirmPasswordInput = await screen.findByLabelText( | ||
'Confirm password' | ||
); | ||
await user.clear(confirmPasswordInput); | ||
await user.type(confirmPasswordInput, 'IAmThePass1!@'); | ||
|
||
await screen.findByText('Passwords match'); | ||
|
||
const saveButton = await screen.findByText('Save'); | ||
await user.click(saveButton); | ||
|
||
await screen.findByText('Authentication required'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters