summaryrefslogtreecommitdiff
path: root/spec/frontend/api_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/api_spec.js')
-rw-r--r--spec/frontend/api_spec.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/frontend/api_spec.js b/spec/frontend/api_spec.js
index d2522a0124a..d6e1b170dd3 100644
--- a/spec/frontend/api_spec.js
+++ b/spec/frontend/api_spec.js
@@ -482,6 +482,30 @@ describe('Api', () => {
});
});
+ describe('projectShareWithGroup', () => {
+ it('invites a group to share access with the authenticated project', () => {
+ const projectId = 1;
+ const sharedGroupId = 99;
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectId}/share`;
+ const options = {
+ group_id: sharedGroupId,
+ group_access: 10,
+ expires_at: undefined,
+ };
+
+ jest.spyOn(axios, 'post');
+
+ mock.onPost(expectedUrl).reply(200, {
+ status: 'success',
+ });
+
+ return Api.projectShareWithGroup(projectId, options).then(({ data }) => {
+ expect(data.status).toBe('success');
+ expect(axios.post).toHaveBeenCalledWith(expectedUrl, options);
+ });
+ });
+ });
+
describe('projectMilestones', () => {
it('fetches project milestones', (done) => {
const projectId = 1;
@@ -638,6 +662,30 @@ describe('Api', () => {
});
});
+ describe('groupShareWithGroup', () => {
+ it('invites a group to share access with the authenticated group', () => {
+ const groupId = 1;
+ const sharedGroupId = 99;
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/share`;
+ const options = {
+ group_id: sharedGroupId,
+ group_access: 10,
+ expires_at: undefined,
+ };
+
+ jest.spyOn(axios, 'post');
+
+ mock.onPost(expectedUrl).reply(200, {
+ status: 'success',
+ });
+
+ return Api.groupShareWithGroup(groupId, options).then(({ data }) => {
+ expect(data.status).toBe('success');
+ expect(axios.post).toHaveBeenCalledWith(expectedUrl, options);
+ });
+ });
+ });
+
describe('commit', () => {
const projectId = 'user/project';
const sha = 'abcd0123';