summaryrefslogtreecommitdiff
path: root/spec/frontend/api_spec.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/frontend/api_spec.js
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/frontend/api_spec.js')
-rw-r--r--spec/frontend/api_spec.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/frontend/api_spec.js b/spec/frontend/api_spec.js
index d365048ab0b..c1a23d441b3 100644
--- a/spec/frontend/api_spec.js
+++ b/spec/frontend/api_spec.js
@@ -691,4 +691,60 @@ describe('Api', () => {
});
});
});
+
+ describe('updateIssue', () => {
+ it('update an issue with the given payload', done => {
+ const projectId = 8;
+ const issue = 1;
+ const expectedArray = [1, 2, 3];
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectId}/issues/${issue}`;
+ mock.onPut(expectedUrl).reply(200, { assigneeIds: expectedArray });
+
+ Api.updateIssue(projectId, issue, { assigneeIds: expectedArray })
+ .then(({ data }) => {
+ expect(data.assigneeIds).toEqual(expectedArray);
+ done();
+ })
+ .catch(done.fail);
+ });
+ });
+
+ describe('updateMergeRequest', () => {
+ it('update an issue with the given payload', done => {
+ const projectId = 8;
+ const mergeRequest = 1;
+ const expectedArray = [1, 2, 3];
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectId}/merge_requests/${mergeRequest}`;
+ mock.onPut(expectedUrl).reply(200, { assigneeIds: expectedArray });
+
+ Api.updateMergeRequest(projectId, mergeRequest, { assigneeIds: expectedArray })
+ .then(({ data }) => {
+ expect(data.assigneeIds).toEqual(expectedArray);
+ done();
+ })
+ .catch(done.fail);
+ });
+ });
+
+ describe('tags', () => {
+ it('fetches all tags of a particular project', done => {
+ const query = 'dummy query';
+ const options = { unused: 'option' };
+ const projectId = 8;
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectId}/repository/tags`;
+ mock.onGet(expectedUrl).reply(200, [
+ {
+ name: 'test',
+ },
+ ]);
+
+ Api.tags(projectId, query, options)
+ .then(({ data }) => {
+ expect(data.length).toBe(1);
+ expect(data[0].name).toBe('test');
+ })
+ .then(done)
+ .catch(done.fail);
+ });
+ });
});