Add encodeURIComponent for username in API URL paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,16 @@ describe('acctMgmtStore', () => {
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('encodes special characters in username', async () => {
|
||||
mockDelete.mockResolvedValue({ status: 200 });
|
||||
|
||||
await store.deleteAccount('user@domain/name');
|
||||
|
||||
expect(mockDelete).toHaveBeenCalledWith(
|
||||
'/api/users/user%40domain%2Fname',
|
||||
);
|
||||
});
|
||||
|
||||
it('returns false on error', async () => {
|
||||
mockDelete.mockRejectedValue(new Error('fail'));
|
||||
|
||||
@@ -154,6 +164,16 @@ describe('acctMgmtStore', () => {
|
||||
);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('encodes special characters in username and role', async () => {
|
||||
mockPut.mockResolvedValue({ status: 200 });
|
||||
|
||||
await store.addRoleToUser('user@org', 'role/special');
|
||||
|
||||
expect(mockPut).toHaveBeenCalledWith(
|
||||
'/api/users/user%40org/roles/role%2Fspecial',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('deleteRoleToUser', () => {
|
||||
|
||||
Reference in New Issue
Block a user