fix: surface server errors on password change and TOTP toggle

This commit is contained in:
Linus Rath
2026-06-24 18:02:18 +02:00
parent 1119d8ed73
commit 85fbab9eb4
2 changed files with 38 additions and 4 deletions
@@ -222,6 +222,20 @@ describe('account-security-store', () => {
expect(useAccountSecurityStore.getState().error).toBe('forbidden');
expect(useAccountSecurityStore.getState().isSaving).toBe(false);
});
it('throws the server message when the set comes back as notUpdated (HTTP 200)', async () => {
mockedJmap.mockResolvedValueOnce([
['x:AccountPassword/set', {
notUpdated: { singleton: { type: 'invalidProperties', description: 'Current password is incorrect' } },
}, '0'],
]);
await expect(
useAccountSecurityStore.getState().changePassword('wrong', 'new'),
).rejects.toThrow('Current password is incorrect');
expect(useAccountSecurityStore.getState().error).toBe('Current password is incorrect');
expect(useAccountSecurityStore.getState().isSaving).toBe(false);
});
});
describe('updateDisplayName', () => {