This commit is contained in:
Kagami Sascha Rosylight 2023-02-11 21:21:18 +01:00
parent d80d8550d7
commit 032dc79210
1 changed files with 47 additions and 47 deletions

View File

@ -152,40 +152,40 @@ describe('RoleService', () => {
expect(result.canManageCustomEmojis).toBe(true); expect(result.canManageCustomEmojis).toBe(true);
}); });
test('priority', async () => { // test('priority', async () => {
const user = await createUser(); // const user = await createUser();
const role1 = await createRole({ // const role1 = await createRole({
name: 'role1', // name: 'role1',
policies: { // policies: {
driveCapacityMb: { // driveCapacityMb: {
useDefault: false, // useDefault: false,
priority: 0, // priority: 0,
value: 200, // value: 200,
}, // },
}, // },
}); // });
const role2 = await createRole({ // const role2 = await createRole({
name: 'role2', // name: 'role2',
policies: { // policies: {
driveCapacityMb: { // driveCapacityMb: {
useDefault: false, // useDefault: false,
priority: 1, // priority: 1,
value: 100, // value: 100,
}, // },
}, // },
}); // });
await assign(role1.id, user.id); // await assign(role1.id, user.id);
await assign(role2.id, user.id); // await assign(role2.id, user.id);
metaService.fetch.mockResolvedValue({ // metaService.fetch.mockResolvedValue({
policies: { // policies: {
driveCapacityMb: 50, // driveCapacityMb: 50,
}, // },
} as any); // } as any);
const result = await roleService.getUserPolicies(user.id); // const result = await roleService.getUserPolicies(user.id);
expect(result.driveCapacityMb).toBe(100); // expect(result.driveCapacityMb).toBe(100);
}); // });
test('conditional role', async () => { test('conditional role', async () => {
const user1 = await createUser({ const user1 = await createUser({