|
1 | | -import { ClerkAPIResponseError } from '@clerk/shared/error'; |
2 | 1 | import userEvent from '@testing-library/user-event'; |
3 | 2 | import { describe, expect, it } from 'vitest'; |
4 | 3 |
|
@@ -65,43 +64,6 @@ describe('TaskResetPassword', () => { |
65 | 64 | }); |
66 | 65 | }); |
67 | 66 |
|
68 | | - it('giving the same password as the current password, should show an error', async () => { |
69 | | - const { wrapper, fixtures } = await createFixtures(f => { |
70 | | - f.withUser({ |
71 | | - email_addresses: ['test@clerk.com'], |
72 | | - identifier: 'test@clerk.com', |
73 | | - tasks: [{ key: 'reset-password' }], |
74 | | - }); |
75 | | - f.withPassword(); |
76 | | - }); |
77 | | - |
78 | | - const errJSON = { |
79 | | - code: 'form_new_password_matches_current', |
80 | | - long_message: 'New password cannot be the same as the current password.', |
81 | | - message: 'New password cannot be the same as the current password.', |
82 | | - meta: { param_name: 'newPassword' }, |
83 | | - }; |
84 | | - |
85 | | - fixtures.clerk.user?.updatePassword.mockResolvedValueOnce( |
86 | | - new ClerkAPIResponseError('Error', { |
87 | | - data: [errJSON], |
88 | | - status: 422, |
89 | | - }), |
90 | | - ); |
91 | | - const { getByRole, userEvent, getByLabelText, findByText } = render(<TaskResetPassword />, { wrapper }); |
92 | | - await waitFor(() => getByRole('heading', { name: /Reset password/i })); |
93 | | - |
94 | | - await userEvent.type(getByLabelText(/new password/i), 'itsthesamepassword'); |
95 | | - await userEvent.type(getByLabelText(/confirm password/i), 'itsthesamepassword'); |
96 | | - await userEvent.click(getByRole('button', { name: /reset password$/i })); |
97 | | - expect(fixtures.clerk.user?.updatePassword).toHaveBeenCalledWith({ |
98 | | - newPassword: 'itsthesamepassword', |
99 | | - signOutOfOtherSessions: true, |
100 | | - }); |
101 | | - |
102 | | - await waitFor(() => expect(findByText(/new password cannot be the same as the current password/i)).toBeVisible()); |
103 | | - }); |
104 | | - |
105 | 67 | it('renders a hidden identifier field', async () => { |
106 | 68 | const { wrapper } = await createFixtures(f => { |
107 | 69 | f.withUser({ |
|
0 commit comments