0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(ui): fix ut

fix ut
This commit is contained in:
simeng-li 2022-10-10 15:32:41 +08:00
parent d65ba52f03
commit 9ea6a8c8e9
No known key found for this signature in database
GPG key ID: 14EA7BB1541E8075

View file

@ -21,12 +21,12 @@ describe('<ResetPassword />', () => {
const { queryByText, container } = renderWithPageContext(<ResetPassword />);
expect(container.querySelector('input[name="new-password"]')).not.toBeNull();
expect(container.querySelector('input[name="confirm-new-password"]')).not.toBeNull();
expect(queryByText('action.confirm')).not.toBeNull();
expect(queryByText('action.save_password')).not.toBeNull();
});
test('password are required', () => {
const { queryByText, getByText } = renderWithPageContext(<ResetPassword />);
const submitButton = getByText('action.confirm');
const submitButton = getByText('action.save_password');
fireEvent.click(submitButton);
expect(queryByText('password_required')).not.toBeNull();
@ -35,7 +35,7 @@ describe('<ResetPassword />', () => {
test('password less than 6 chars should throw', () => {
const { queryByText, getByText, container } = renderWithPageContext(<ResetPassword />);
const submitButton = getByText('action.confirm');
const submitButton = getByText('action.save_password');
const passwordInput = container.querySelector('input[name="new-password"]');
if (passwordInput) {
@ -62,7 +62,7 @@ describe('<ResetPassword />', () => {
test('password mismatch with confirmPassword should throw', () => {
const { queryByText, getByText, container } = renderWithPageContext(<ResetPassword />);
const submitButton = getByText('action.confirm');
const submitButton = getByText('action.save_password');
const passwordInput = container.querySelector('input[name="new-password"]');
const confirmPasswordInput = container.querySelector('input[name="confirm-new-password"]');
@ -94,7 +94,7 @@ describe('<ResetPassword />', () => {
test('should submit properly', async () => {
const { queryByText, getByText, container } = renderWithPageContext(<ResetPassword />);
const submitButton = getByText('action.confirm');
const submitButton = getByText('action.save_password');
const passwordInput = container.querySelector('input[name="new-password"]');
const confirmPasswordInput = container.querySelector('input[name="confirm-new-password"]');