summaryrefslogtreecommitdiff
path: root/spec/javascripts/ide/stores/actions_spec.js
diff options
context:
space:
mode:
authorDenys Mishunov <dmishunov@gitlab.com>2019-07-02 11:12:16 +0000
committerPhil Hughes <me@iamphill.com>2019-07-02 11:12:16 +0000
commit5a7834e5a91549b5ecb8890a718efa93dd61ae7a (patch)
treeb65ffc957ffc3024734bff752e426cd8757c1f6c /spec/javascripts/ide/stores/actions_spec.js
parentc2118657dbe7728a751f29767cc89b4a80f39b92 (diff)
downloadgitlab-ce-5a7834e5a91549b5ecb8890a718efa93dd61ae7a.tar.gz
Allow adding new entries to existing path
If an entry has been removed from the tree and later, during the same session, a user is trying to add a new item with the same name/path we should allow for that as long as the original entry is marked with `deleted`.
Diffstat (limited to 'spec/javascripts/ide/stores/actions_spec.js')
-rw-r--r--spec/javascripts/ide/stores/actions_spec.js43
1 files changed, 32 insertions, 11 deletions
diff --git a/spec/javascripts/ide/stores/actions_spec.js b/spec/javascripts/ide/stores/actions_spec.js
index 2d105103c1c..8504fb3f42b 100644
--- a/spec/javascripts/ide/stores/actions_spec.js
+++ b/spec/javascripts/ide/stores/actions_spec.js
@@ -10,6 +10,7 @@ import actions, {
deleteEntry,
renameEntry,
getBranchData,
+ createTempEntry,
} from '~/ide/stores/actions';
import axios from '~/lib/utils/axios_utils';
import store from '~/ide/stores';
@@ -247,18 +248,30 @@ describe('Multi-file store actions', () => {
});
it('sets tmp file as active', done => {
- store
- .dispatch('createTempEntry', {
+ testAction(
+ createTempEntry,
+ {
name: 'test',
branchId: 'mybranch',
type: 'blob',
- })
- .then(f => {
- expect(f.active).toBeTruthy();
-
- done();
- })
- .catch(done.fail);
+ },
+ store.state,
+ [
+ { type: types.CREATE_TMP_ENTRY, payload: jasmine.any(Object) },
+ { type: types.TOGGLE_FILE_OPEN, payload: 'test' },
+ { type: types.ADD_FILE_TO_CHANGED, payload: 'test' },
+ ],
+ [
+ {
+ type: 'setFileActive',
+ payload: 'test',
+ },
+ {
+ type: 'triggerFilesChange',
+ },
+ ],
+ done,
+ );
});
it('creates flash message if file already exists', done => {
@@ -488,7 +501,11 @@ describe('Multi-file store actions', () => {
'path',
store.state,
[{ type: types.DELETE_ENTRY, payload: 'path' }],
- [{ type: 'burstUnusedSeal' }, { type: 'triggerFilesChange' }],
+ [
+ { type: 'burstUnusedSeal' },
+ { type: 'stageChange', payload: 'path' },
+ { type: 'triggerFilesChange' },
+ ],
done,
);
});
@@ -515,7 +532,11 @@ describe('Multi-file store actions', () => {
'testFolder/entry-to-delete',
store.state,
[{ type: types.DELETE_ENTRY, payload: 'testFolder/entry-to-delete' }],
- [{ type: 'burstUnusedSeal' }, { type: 'triggerFilesChange' }],
+ [
+ { type: 'burstUnusedSeal' },
+ { type: 'stageChange', payload: 'testFolder/entry-to-delete' },
+ { type: 'triggerFilesChange' },
+ ],
done,
);
});