mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
fix(core): update role names (#913)
This commit is contained in:
parent
5e0c39e516
commit
d65999514f
2 changed files with 12 additions and 1 deletions
|
@ -237,6 +237,17 @@ describe('adminUserRoutes', () => {
|
||||||
expect(updateUserById).not.toHaveBeenCalled();
|
expect(updateUserById).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('PATCH /users/:userId should update if roleNames field is an empty array', async () => {
|
||||||
|
const roleNames: string[] = [];
|
||||||
|
|
||||||
|
const response = await userRequest.patch('/users/foo').send({ roleNames });
|
||||||
|
expect(response.status).toEqual(200);
|
||||||
|
expect(response.body).toEqual({
|
||||||
|
...mockUserResponse,
|
||||||
|
roleNames,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('PATCH /users/:userId/password', async () => {
|
it('PATCH /users/:userId/password', async () => {
|
||||||
const mockedUserId = 'foo';
|
const mockedUserId = 'foo';
|
||||||
const password = '123456';
|
const password = '123456';
|
||||||
|
|
|
@ -130,7 +130,7 @@ export default function adminUserRoutes<T extends AuthedRouter>(router: T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temp solution to validate the existence of input roleNames
|
// Temp solution to validate the existence of input roleNames
|
||||||
if (body.roleNames) {
|
if (body.roleNames?.length) {
|
||||||
const { roleNames } = body;
|
const { roleNames } = body;
|
||||||
const roles = await findRolesByRoleNames(roleNames);
|
const roles = await findRolesByRoleNames(roleNames);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue