feat/Update_Controllers_to_Allow_for_Premium_Membership

This commit is contained in:
cesnimda
2026-08-03 09:17:28 +02:00
parent de937d25dc
commit c3f4a57195
187 changed files with 26062 additions and 991 deletions
+19
View File
@@ -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();
});