From d4cc92db09a0c765556882943b7508075a0ab0e2 Mon Sep 17 00:00:00 2001 From: Paul Slaughter Date: Wed, 26 Jun 2019 09:07:56 -0500 Subject: FE remove create branch call in IDE commit Previously `start_sha` was intercepted on the frontend to create the correct branch in a separate API call. Now that the commits API supports the `start_sha` parameter directly this workaround is not needed anymore. --- spec/frontend/ide/services/index_spec.js | 32 +++------------------- .../ide/stores/modules/commit/actions_spec.js | 2 +- 2 files changed, 5 insertions(+), 29 deletions(-) (limited to 'spec') diff --git a/spec/frontend/ide/services/index_spec.js b/spec/frontend/ide/services/index_spec.js index 499fa8fc012..3d5ed4b5c0c 100644 --- a/spec/frontend/ide/services/index_spec.js +++ b/spec/frontend/ide/services/index_spec.js @@ -16,40 +16,16 @@ describe('IDE services', () => { branch: TEST_BRANCH, commit_message: 'Hello world', actions: [], - start_sha: undefined, + start_sha: TEST_COMMIT_SHA, }; - Api.createBranch.mockReturnValue(Promise.resolve()); Api.commitMultiple.mockReturnValue(Promise.resolve()); }); - describe.each` - startSha | shouldCreateBranch - ${undefined} | ${false} - ${TEST_COMMIT_SHA} | ${true} - `('when start_sha is $startSha', ({ startSha, shouldCreateBranch }) => { - beforeEach(() => { - payload.start_sha = startSha; + it('should commit', () => { + services.commit(TEST_PROJECT_ID, payload); - return services.commit(TEST_PROJECT_ID, payload); - }); - - if (shouldCreateBranch) { - it('should create branch', () => { - expect(Api.createBranch).toHaveBeenCalledWith(TEST_PROJECT_ID, { - ref: TEST_COMMIT_SHA, - branch: TEST_BRANCH, - }); - }); - } else { - it('should not create branch', () => { - expect(Api.createBranch).not.toHaveBeenCalled(); - }); - } - - it('should commit', () => { - expect(Api.commitMultiple).toHaveBeenCalledWith(TEST_PROJECT_ID, payload); - }); + expect(Api.commitMultiple).toHaveBeenCalledWith(TEST_PROJECT_ID, payload); }); }); }); diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js index 8a3c132972e..590af53b3f2 100644 --- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js @@ -245,7 +245,7 @@ describe('IDE commit module actions', () => { master: { workingReference: '1', commit: { - short_id: TEST_COMMIT_SHA, + id: TEST_COMMIT_SHA, }, }, }, -- cgit v1.2.1