fix: close permission review gaps
fix: harden permission-gated UI — minimum-org endpoint, modal/Popconfirm fail-closed on revocation
This commit is contained in:
@@ -27,4 +27,21 @@ describe('OrganizationsService — host organization rules', () => {
|
||||
await expect(service.remove(1)).rejects.toBeInstanceOf(BadRequestException);
|
||||
expect(repo.update).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('findOptions returns only id, name, isHost for active organizations', async () => {
|
||||
const orgs = [
|
||||
{ id: 1, name: '本机构', isHost: true },
|
||||
{ id: 2, name: '分校', isHost: false },
|
||||
];
|
||||
repo.find.mockResolvedValue(orgs as Organization[]);
|
||||
|
||||
const result = await service.findOptions();
|
||||
|
||||
expect(repo.find).toHaveBeenCalledWith({
|
||||
select: ['id', 'name', 'isHost'],
|
||||
where: { status: 'active' },
|
||||
order: { isHost: 'DESC', name: 'ASC' },
|
||||
});
|
||||
expect(result).toEqual(orgs);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user