Skip to content

Commit

Permalink
feat(group): add listExclusivePrivileges method
Browse files Browse the repository at this point in the history
  • Loading branch information
gdostie committed Dec 18, 2019
1 parent 18e044b commit 942112c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/resources/Groups/Groups.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import API from '../../APICore';
import {New} from '../BaseInterfaces';
import {New, PrivilegeModel} from '../BaseInterfaces';
import Resource from '../Resource';
import {CreateGroupOptions, GroupModel, UpdateGroupOptions} from './GroupsInterfaces';
import GroupInvite from './Invites/GroupInvite';
Expand Down Expand Up @@ -40,4 +40,8 @@ export default class Group extends Resource {
update(group: GroupModel, options?: UpdateGroupOptions) {
return this.api.put(this.buildPath(`${Group.baseUrl}/${group.id}`, options), group);
}

listExclusivePrivileges(groupId: string) {
return this.api.get<PrivilegeModel[]>(`${Group.baseUrl}/${groupId}/privileges/exclusive/me`);
}
}
11 changes: 11 additions & 0 deletions src/resources/Groups/tests/Groups.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ describe('Group', () => {
});
});

describe('listExclusivePrivileges', () => {
it('should make a GET call to the /groups/{groupId}/privileges/exclusive/me', () => {
group.listExclusivePrivileges('💎');

expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(
'/rest/organizations/{organizationName}/groups/💎/privileges/exclusive/me'
);
});
});

it('should register the realm resource', () => {
expect(group.realm).toBeDefined();
expect(group.realm).toBeInstanceOf(GroupRealm);
Expand Down

0 comments on commit 942112c

Please sign in to comment.