summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2019-06-17 12:53:58 -0500
committerPaul Slaughter <pslaughter@gitlab.com>2019-06-17 14:04:35 -0500
commit894ad6f6e983cb17c7b63b4185c63a42b6203a4f (patch)
treebd3990e5b4fe0e9521287bf0c327925a82084c50 /spec/javascripts
parent89a89b3230717920410de6fb6d6b7152ef41a03e (diff)
downloadgitlab-ce-894ad6f6e983cb17c7b63b4185c63a42b6203a4f.tar.gz
**Why?** The branch HEAD could be changed since the IDE was opened. This leads to user's unintentionally creating commits that overwrite other changes. https://gitlab.com/gitlab-org/gitlab-ce/issues/59023
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/ide/stores/modules/commit/actions_spec.js18
-rw-r--r--spec/javascripts/ide/stores/utils_spec.js4
2 files changed, 15 insertions, 7 deletions
diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js
index 5f7272311c8..8a3c132972e 100644
--- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js
+++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js
@@ -6,9 +6,11 @@ import eventHub from '~/ide/eventhub';
import consts from '~/ide/stores/modules/commit/constants';
import * as mutationTypes from '~/ide/stores/modules/commit/mutation_types';
import * as actions from '~/ide/stores/modules/commit/actions';
-import testAction from '../../../../helpers/vuex_action_helper';
import { commitActionTypes } from '~/ide/constants';
import { resetStore, file } from 'spec/ide/helpers';
+import testAction from '../../../../helpers/vuex_action_helper';
+
+const TEST_COMMIT_SHA = '123456789';
describe('IDE commit module actions', () => {
beforeEach(() => {
@@ -139,6 +141,9 @@ describe('IDE commit module actions', () => {
branches: {
master: {
workingReference: '',
+ commit: {
+ short_id: TEST_COMMIT_SHA,
+ },
},
},
};
@@ -239,6 +244,9 @@ describe('IDE commit module actions', () => {
branches: {
master: {
workingReference: '1',
+ commit: {
+ short_id: TEST_COMMIT_SHA,
+ },
},
},
};
@@ -247,7 +255,7 @@ describe('IDE commit module actions', () => {
...file('changed'),
type: 'blob',
active: true,
- lastCommitSha: '123456789',
+ lastCommitSha: TEST_COMMIT_SHA,
};
store.state.stagedFiles.push(f);
store.state.changedFiles = [
@@ -307,7 +315,7 @@ describe('IDE commit module actions', () => {
previous_path: undefined,
},
],
- start_branch: 'master',
+ start_sha: TEST_COMMIT_SHA,
});
done();
@@ -330,11 +338,11 @@ describe('IDE commit module actions', () => {
file_path: jasmine.anything(),
content: undefined,
encoding: jasmine.anything(),
- last_commit_id: '123456789',
+ last_commit_id: TEST_COMMIT_SHA,
previous_path: undefined,
},
],
- start_branch: undefined,
+ start_sha: undefined,
});
done();
diff --git a/spec/javascripts/ide/stores/utils_spec.js b/spec/javascripts/ide/stores/utils_spec.js
index debe1c4acee..e3bf6d40245 100644
--- a/spec/javascripts/ide/stores/utils_spec.js
+++ b/spec/javascripts/ide/stores/utils_spec.js
@@ -132,7 +132,7 @@ describe('Multi-file store utils', () => {
previous_path: undefined,
},
],
- start_branch: undefined,
+ start_sha: undefined,
});
});
@@ -187,7 +187,7 @@ describe('Multi-file store utils', () => {
previous_path: undefined,
},
],
- start_branch: undefined,
+ start_sha: undefined,
});
});
});