0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

test: remove tests with defaultManagementApi.role.id (#3855)

This commit is contained in:
wangsijie 2023-05-17 15:19:12 +08:00 committed by GitHub
parent b6dc70f9df
commit f953289f75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,3 @@
import { defaultManagementApi } from '@logto/schemas';
import { HTTPError } from 'got';
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 () => {
const user = await createUserByAdmin();
const role = await createRole();
await assignRolesToUser(user.id, [defaultManagementApi.role.id]);
await deleteRoleFromUser(user.id, defaultManagementApi.role.id);
await assignRolesToUser(user.id, [role.id]);
await deleteRoleFromUser(user.id, role.id);
const roles = await getUserRoles(user.id);
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 () => {
const user = await createUserByAdmin();
const role = await createRole();
const response = await deleteRoleFromUser(user.id, defaultManagementApi.role.id).catch(
(error: unknown) => error
);
const response = await deleteRoleFromUser(user.id, role.id).catch((error: unknown) => error);
expect(response instanceof HTTPError && response.response.statusCode === 404).toBe(true);
});
});