mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
test: remove tests with defaultManagementApi.role.id (#3855)
This commit is contained in:
parent
b6dc70f9df
commit
f953289f75
1 changed files with 5 additions and 6 deletions
|
@ -1,4 +1,3 @@
|
||||||
import { defaultManagementApi } from '@logto/schemas';
|
|
||||||
import { HTTPError } from 'got';
|
import { HTTPError } from 'got';
|
||||||
|
|
||||||
import { assignRolesToUser, getUserRoles, deleteRoleFromUser } from '#src/api/index.js';
|
import { assignRolesToUser, getUserRoles, deleteRoleFromUser } from '#src/api/index.js';
|
||||||
|
@ -35,9 +34,10 @@ describe('admin console user management (roles)', () => {
|
||||||
|
|
||||||
it('should delete role from user successfully', async () => {
|
it('should delete role from user successfully', async () => {
|
||||||
const user = await createUserByAdmin();
|
const user = await createUserByAdmin();
|
||||||
|
const role = await createRole();
|
||||||
|
|
||||||
await assignRolesToUser(user.id, [defaultManagementApi.role.id]);
|
await assignRolesToUser(user.id, [role.id]);
|
||||||
await deleteRoleFromUser(user.id, defaultManagementApi.role.id);
|
await deleteRoleFromUser(user.id, role.id);
|
||||||
|
|
||||||
const roles = await getUserRoles(user.id);
|
const roles = await getUserRoles(user.id);
|
||||||
expect(roles.length).toBe(0);
|
expect(roles.length).toBe(0);
|
||||||
|
@ -45,10 +45,9 @@ describe('admin console user management (roles)', () => {
|
||||||
|
|
||||||
it('should delete non-exist-role from user failed', async () => {
|
it('should delete non-exist-role from user failed', async () => {
|
||||||
const user = await createUserByAdmin();
|
const user = await createUserByAdmin();
|
||||||
|
const role = await createRole();
|
||||||
|
|
||||||
const response = await deleteRoleFromUser(user.id, defaultManagementApi.role.id).catch(
|
const response = await deleteRoleFromUser(user.id, role.id).catch((error: unknown) => error);
|
||||||
(error: unknown) => error
|
|
||||||
);
|
|
||||||
expect(response instanceof HTTPError && response.response.statusCode === 404).toBe(true);
|
expect(response instanceof HTTPError && response.response.statusCode === 404).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue