Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-14 12:09:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-14 12:09:34 +0300
commit97f0ae7454597105a27df65ffb772949d9d4f3cb (patch)
tree0bf4888e0e9082c8f168a211390a73a6ae810cef /spec/frontend/api_spec.js
parent5ebc4d92cd5fbb46c627eb04d500384893dbe2b4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/api_spec.js')
-rw-r--r--spec/frontend/api_spec.js34
1 files changed, 33 insertions, 1 deletions
diff --git a/spec/frontend/api_spec.js b/spec/frontend/api_spec.js
index fdefa16ac19..f34c2fb69eb 100644
--- a/spec/frontend/api_spec.js
+++ b/spec/frontend/api_spec.js
@@ -651,7 +651,7 @@ describe('Api', () => {
describe('when an error occurs while getting a raw file', () => {
it('rejects the Promise', () => {
- mock.onDelete(expectedUrl).replyOnce(500);
+ mock.onPost(expectedUrl).replyOnce(500);
return Api.getRawFile(dummyProjectPath, dummyFilePath).catch(() => {
expect(mock.history.get).toHaveLength(1);
@@ -659,4 +659,36 @@ describe('Api', () => {
});
});
});
+
+ describe('createProjectMergeRequest', () => {
+ const dummyProjectPath = 'gitlab-org/gitlab';
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${encodeURIComponent(
+ dummyProjectPath,
+ )}/merge_requests`;
+ const options = {
+ source_branch: 'feature',
+ target_branch: 'master',
+ title: 'Add feature',
+ };
+
+ describe('when the merge request is successfully created', () => {
+ it('resolves the Promise', () => {
+ mock.onPost(expectedUrl, options).replyOnce(201);
+
+ return Api.createProjectMergeRequest(dummyProjectPath, options).then(() => {
+ expect(mock.history.post).toHaveLength(1);
+ });
+ });
+ });
+
+ describe('when an error occurs while getting a raw file', () => {
+ it('rejects the Promise', () => {
+ mock.onPost(expectedUrl).replyOnce(500);
+
+ return Api.createProjectMergeRequest(dummyProjectPath).catch(() => {
+ expect(mock.history.post).toHaveLength(1);
+ });
+ });
+ });
+ });
});