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:
Diffstat (limited to 'spec/javascripts/ide/stores/utils_spec.js')
-rw-r--r--spec/javascripts/ide/stores/utils_spec.js39
1 files changed, 14 insertions, 25 deletions
diff --git a/spec/javascripts/ide/stores/utils_spec.js b/spec/javascripts/ide/stores/utils_spec.js
index 89db50b8874..9f18034f8a3 100644
--- a/spec/javascripts/ide/stores/utils_spec.js
+++ b/spec/javascripts/ide/stores/utils_spec.js
@@ -112,6 +112,7 @@ describe('Multi-file store utils', () => {
content: 'updated file content',
encoding: 'text',
last_commit_id: '123456789',
+ previous_path: undefined,
},
{
action: 'create',
@@ -119,13 +120,15 @@ describe('Multi-file store utils', () => {
content: 'new file content',
encoding: 'base64',
last_commit_id: '123456789',
+ previous_path: undefined,
},
{
action: 'delete',
file_path: 'deletedFile',
- content: '',
+ content: undefined,
encoding: 'text',
last_commit_id: undefined,
+ previous_path: undefined,
},
],
start_branch: undefined,
@@ -172,6 +175,7 @@ describe('Multi-file store utils', () => {
content: 'updated file content',
encoding: 'text',
last_commit_id: '123456789',
+ previous_path: undefined,
},
{
action: 'create',
@@ -179,6 +183,7 @@ describe('Multi-file store utils', () => {
content: 'new file content',
encoding: 'base64',
last_commit_id: '123456789',
+ previous_path: undefined,
},
],
start_branch: undefined,
@@ -195,13 +200,17 @@ describe('Multi-file store utils', () => {
expect(utils.commitActionForFile({ tempFile: true })).toBe('create');
});
+ it('returns move for moved file', () => {
+ expect(utils.commitActionForFile({ prevPath: 'test' })).toBe('move');
+ });
+
it('returns update by default', () => {
expect(utils.commitActionForFile({})).toBe('update');
});
});
describe('getCommitFiles', () => {
- it('returns flattened list of files and folders', () => {
+ it('returns list of files excluding moved files', () => {
const files = [
{
path: 'a',
@@ -209,19 +218,9 @@ describe('Multi-file store utils', () => {
deleted: true,
},
{
- path: 'b',
- type: 'tree',
- deleted: true,
- tree: [
- {
- path: 'c',
- type: 'blob',
- },
- {
- path: 'd',
- type: 'blob',
- },
- ],
+ path: 'c',
+ type: 'blob',
+ moved: true,
},
];
@@ -233,16 +232,6 @@ describe('Multi-file store utils', () => {
type: 'blob',
deleted: true,
},
- {
- path: 'c',
- type: 'blob',
- deleted: true,
- },
- {
- path: 'd',
- type: 'blob',
- deleted: true,
- },
]);
});
});