feat/Update_Controllers_to_Allow_for_Premium_Membership
This commit is contained in:
@@ -358,3 +358,22 @@ test('pending CV extraction can be reviewed and applied', async () => {
|
||||
acceptedLowConfidenceIds: ['Languages|french'],
|
||||
}));
|
||||
});
|
||||
|
||||
test('account email changes require a password and use the confirmation flow', async () => {
|
||||
mockedApi.post.mockImplementation((url: string) => {
|
||||
if (url === '/auth/email-change/request') return Promise.resolve({ data: { pendingEmail: 'new@example.com' } } as any);
|
||||
return Promise.resolve({ data: {} } as any);
|
||||
});
|
||||
renderWith(ProfilePage);
|
||||
|
||||
const email = await screen.findByLabelText(/new email/i);
|
||||
fireEvent.change(email, { target: { value: 'new@example.com' } });
|
||||
fireEvent.change(screen.getByLabelText(/password to confirm email change/i), { target: { value: 'password1' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: /send confirmation/i }));
|
||||
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledWith('/auth/email-change/request', {
|
||||
email: 'new@example.com',
|
||||
currentPassword: 'password1',
|
||||
}));
|
||||
expect(await screen.findByText(/waiting for confirmation from new@example.com/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user