mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
ci: update AclEntry model tests
This commit is contained in:
parent
90dd0198db
commit
fddf1196c9
1 changed files with 4 additions and 20 deletions
|
|
@ -271,22 +271,7 @@ describe('AclEntry Model Tests', () => {
|
||||||
const effective = await methods.getEffectivePermissions(principalsList, 'agent', resourceId);
|
const effective = await methods.getEffectivePermissions(principalsList, 'agent', resourceId);
|
||||||
|
|
||||||
/** Combined permissions should be VIEW | EDIT */
|
/** Combined permissions should be VIEW | EDIT */
|
||||||
expect(effective.effectiveBits).toBe(PermissionBits.VIEW | PermissionBits.EDIT);
|
expect(effective).toBe(PermissionBits.VIEW | PermissionBits.EDIT);
|
||||||
|
|
||||||
/** Should have 2 sources */
|
|
||||||
expect(effective.sources).toHaveLength(2);
|
|
||||||
|
|
||||||
/** Check sources */
|
|
||||||
const userSource = effective.sources.find((s) => s.from === 'user');
|
|
||||||
const groupSource = effective.sources.find((s) => s.from === 'group');
|
|
||||||
|
|
||||||
expect(userSource).toBeDefined();
|
|
||||||
expect(userSource?.permBits).toBe(PermissionBits.VIEW);
|
|
||||||
expect(userSource?.direct).toBe(true);
|
|
||||||
|
|
||||||
expect(groupSource).toBeDefined();
|
|
||||||
expect(groupSource?.permBits).toBe(PermissionBits.EDIT);
|
|
||||||
expect(groupSource?.direct).toBe(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -489,16 +474,15 @@ describe('AclEntry Model Tests', () => {
|
||||||
inheritedFrom: projectId,
|
inheritedFrom: projectId,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Get effective permissions including sources */
|
/** Get effective permissions */
|
||||||
const effective = await methods.getEffectivePermissions(
|
const effective = await methods.getEffectivePermissions(
|
||||||
[{ principalType: 'user', principalId: userId }],
|
[{ principalType: 'user', principalId: userId }],
|
||||||
'agent',
|
'agent',
|
||||||
childResourceId,
|
childResourceId,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(effective.sources).toHaveLength(1);
|
/** Should have VIEW permission from inherited entry */
|
||||||
expect(effective.sources[0].inheritedFrom?.toString()).toBe(projectId.toString());
|
expect(effective).toBe(PermissionBits.VIEW);
|
||||||
expect(effective.sources[0].direct).toBe(false);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue