summaryrefslogtreecommitdiff
path: root/spec/frontend/ide
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/ide')
-rw-r--r--spec/frontend/ide/components/activity_bar_spec.js4
-rw-r--r--spec/frontend/ide/components/branches/search_list_spec.js2
-rw-r--r--spec/frontend/ide/components/commit_sidebar/actions_spec.js6
-rw-r--r--spec/frontend/ide/components/commit_sidebar/empty_state_spec.js2
-rw-r--r--spec/frontend/ide/components/commit_sidebar/list_item_spec.js10
-rw-r--r--spec/frontend/ide/components/commit_sidebar/list_spec.js2
-rw-r--r--spec/frontend/ide/components/commit_sidebar/message_field_spec.js16
-rw-r--r--spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js14
-rw-r--r--spec/frontend/ide/components/commit_sidebar/radio_group_spec.js14
-rw-r--r--spec/frontend/ide/components/commit_sidebar/success_message_spec.js4
-rw-r--r--spec/frontend/ide/components/error_message_spec.js4
-rw-r--r--spec/frontend/ide/components/file_row_extra_spec.js35
-rw-r--r--spec/frontend/ide/components/file_templates/bar_spec.js11
-rw-r--r--spec/frontend/ide/components/file_templates/dropdown_spec.js8
-rw-r--r--spec/frontend/ide/components/ide_review_spec.js4
-rw-r--r--spec/frontend/ide/components/ide_sidebar_nav_spec.js7
-rw-r--r--spec/frontend/ide/components/ide_spec.js2
-rw-r--r--spec/frontend/ide/components/ide_status_bar_spec.js4
-rw-r--r--spec/frontend/ide/components/ide_status_mr_spec.js2
-rw-r--r--spec/frontend/ide/components/ide_tree_list_spec.js4
-rw-r--r--spec/frontend/ide/components/ide_tree_spec.js2
-rw-r--r--spec/frontend/ide/components/jobs/detail/description_spec.js2
-rw-r--r--spec/frontend/ide/components/jobs/detail/scroll_button_spec.js2
-rw-r--r--spec/frontend/ide/components/jobs/detail_spec.js6
-rw-r--r--spec/frontend/ide/components/jobs/item_spec.js4
-rw-r--r--spec/frontend/ide/components/jobs/list_spec.js4
-rw-r--r--spec/frontend/ide/components/jobs/stage_spec.js7
-rw-r--r--spec/frontend/ide/components/merge_requests/list_spec.js12
-rw-r--r--spec/frontend/ide/components/nav_dropdown_button_spec.js8
-rw-r--r--spec/frontend/ide/components/nav_dropdown_spec.js6
-rw-r--r--spec/frontend/ide/components/new_dropdown/button_spec.js4
-rw-r--r--spec/frontend/ide/components/new_dropdown/index_spec.js2
-rw-r--r--spec/frontend/ide/components/new_dropdown/modal_spec.js2
-rw-r--r--spec/frontend/ide/components/new_dropdown/upload_spec.js10
-rw-r--r--spec/frontend/ide/components/panes/collapsible_sidebar_spec.js4
-rw-r--r--spec/frontend/ide/components/panes/right_spec.js2
-rw-r--r--spec/frontend/ide/components/pipelines/list_spec.js22
-rw-r--r--spec/frontend/ide/components/preview/clientside_spec.js54
-rw-r--r--spec/frontend/ide/components/repo_commit_section_spec.js28
-rw-r--r--spec/frontend/ide/components/repo_editor_spec.js68
-rw-r--r--spec/frontend/ide/components/repo_tabs_spec.js2
-rw-r--r--spec/frontend/ide/components/resizable_panel_spec.js2
-rw-r--r--spec/frontend/ide/components/shared/tokened_input_spec.js6
-rw-r--r--spec/frontend/ide/components/terminal/session_spec.js4
-rw-r--r--spec/frontend/ide/components/terminal/terminal_controls_spec.js2
-rw-r--r--spec/frontend/ide/components/terminal/terminal_spec.js57
-rw-r--r--spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js2
-rw-r--r--spec/frontend/ide/file_helpers.js2
-rw-r--r--spec/frontend/ide/helpers.js11
-rw-r--r--spec/frontend/ide/ide_router_extension_spec.js4
-rw-r--r--spec/frontend/ide/ide_router_spec.js2
-rw-r--r--spec/frontend/ide/lib/common/model_spec.js2
-rw-r--r--spec/frontend/ide/lib/create_diff_spec.js8
-rw-r--r--spec/frontend/ide/lib/create_file_diff_spec.js14
-rw-r--r--spec/frontend/ide/lib/diff/controller_spec.js4
-rw-r--r--spec/frontend/ide/lib/editor_spec.js2
-rw-r--r--spec/frontend/ide/lib/editorconfig/parser_spec.js6
-rw-r--r--spec/frontend/ide/lib/errors_spec.js2
-rw-r--r--spec/frontend/ide/lib/files_spec.js11
-rw-r--r--spec/frontend/ide/lib/languages/hcl_spec.js36
-rw-r--r--spec/frontend/ide/lib/mirror_spec.js4
-rw-r--r--spec/frontend/ide/services/index_spec.js33
-rw-r--r--spec/frontend/ide/stores/actions/file_spec.js38
-rw-r--r--spec/frontend/ide/stores/actions/merge_request_spec.js38
-rw-r--r--spec/frontend/ide/stores/actions/project_spec.js30
-rw-r--r--spec/frontend/ide/stores/actions/tree_spec.js29
-rw-r--r--spec/frontend/ide/stores/actions_spec.js90
-rw-r--r--spec/frontend/ide/stores/extend_spec.js4
-rw-r--r--spec/frontend/ide/stores/getters_spec.js2
-rw-r--r--spec/frontend/ide/stores/integration_spec.js2
-rw-r--r--spec/frontend/ide/stores/modules/branches/actions_spec.js12
-rw-r--r--spec/frontend/ide/stores/modules/branches/mutations_spec.js2
-rw-r--r--spec/frontend/ide/stores/modules/clientside/actions_spec.js2
-rw-r--r--spec/frontend/ide/stores/modules/commit/actions_spec.js95
-rw-r--r--spec/frontend/ide/stores/modules/commit/getters_spec.js2
-rw-r--r--spec/frontend/ide/stores/modules/editor/setup_spec.js11
-rw-r--r--spec/frontend/ide/stores/modules/file_templates/actions_spec.js22
-rw-r--r--spec/frontend/ide/stores/modules/merge_requests/actions_spec.js16
-rw-r--r--spec/frontend/ide/stores/modules/pane/actions_spec.js12
-rw-r--r--spec/frontend/ide/stores/modules/pipelines/actions_spec.js48
-rw-r--r--spec/frontend/ide/stores/modules/pipelines/mutations_spec.js2
-rw-r--r--spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js2
-rw-r--r--spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js2
-rw-r--r--spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js2
-rw-r--r--spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js8
-rw-r--r--spec/frontend/ide/stores/mutations/file_spec.js4
-rw-r--r--spec/frontend/ide/stores/plugins/terminal_sync_spec.js9
-rw-r--r--spec/frontend/ide/sync_router_and_store_spec.js4
-rw-r--r--spec/frontend/ide/utils_spec.js2
89 files changed, 589 insertions, 521 deletions
diff --git a/spec/frontend/ide/components/activity_bar_spec.js b/spec/frontend/ide/components/activity_bar_spec.js
index 762f3c5dad1..1a4b6ca0b71 100644
--- a/spec/frontend/ide/components/activity_bar_spec.js
+++ b/spec/frontend/ide/components/activity_bar_spec.js
@@ -1,8 +1,8 @@
import Vue from 'vue';
+import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
import { createStore } from '~/ide/stores';
import { leftSidebarViews } from '~/ide/constants';
import ActivityBar from '~/ide/components/activity_bar.vue';
-import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
describe('IDE activity bar', () => {
const Component = Vue.extend(ActivityBar);
@@ -59,7 +59,7 @@ describe('IDE activity bar', () => {
expect(vm.$el.querySelector('.js-ide-edit-mode').classList).toContain('active');
});
- it('sets commit item active', done => {
+ it('sets commit item active', (done) => {
vm.$store.state.currentActivityView = leftSidebarViews.commit.name;
vm.$nextTick(() => {
diff --git a/spec/frontend/ide/components/branches/search_list_spec.js b/spec/frontend/ide/components/branches/search_list_spec.js
index fe142d70698..85776f8cc0e 100644
--- a/spec/frontend/ide/components/branches/search_list_spec.js
+++ b/spec/frontend/ide/components/branches/search_list_spec.js
@@ -71,7 +71,7 @@ describe('IDE branches search list', () => {
it('renders check next to active branch', () => {
const activeBranch = 'regular';
createComponent({ branches }, activeBranch);
- const items = wrapper.findAll(Item).filter(w => w.props('isActive'));
+ const items = wrapper.findAll(Item).filter((w) => w.props('isActive'));
expect(items.length).toBe(1);
expect(items.at(0).props('item').name).toBe(activeBranch);
diff --git a/spec/frontend/ide/components/commit_sidebar/actions_spec.js b/spec/frontend/ide/components/commit_sidebar/actions_spec.js
index 0003e13c92f..91751bd34ea 100644
--- a/spec/frontend/ide/components/commit_sidebar/actions_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/actions_spec.js
@@ -30,7 +30,7 @@ describe('IDE commit sidebar actions', () => {
vm.$store.state.currentProjectId = 'abcproject';
const proj = { ...projectData };
- proj.branches[currentBranchId] = branches.find(branch => branch.name === currentBranchId);
+ proj.branches[currentBranchId] = branches.find((branch) => branch.name === currentBranchId);
proj.empty_repo = emptyRepo;
Vue.set(vm.$store.state.projects, 'abcproject', proj);
@@ -72,7 +72,7 @@ describe('IDE commit sidebar actions', () => {
expect(findText()).toContain('Commit to master branch');
});
- it('hides merge request option when project merge requests are disabled', done => {
+ it('hides merge request option when project merge requests are disabled', (done) => {
createComponent({ hasMR: false });
vm.$nextTick(() => {
@@ -106,7 +106,7 @@ describe('IDE commit sidebar actions', () => {
expect(vm.$store.dispatch).not.toHaveBeenCalled();
});
- it('calls again after staged changes', done => {
+ it('calls again after staged changes', (done) => {
createComponent({ currentBranchId: null });
vm.$store.state.currentBranchId = 'master';
diff --git a/spec/frontend/ide/components/commit_sidebar/empty_state_spec.js b/spec/frontend/ide/components/commit_sidebar/empty_state_spec.js
index dbb43e43c19..c1dab4a04b6 100644
--- a/spec/frontend/ide/components/commit_sidebar/empty_state_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/empty_state_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
+import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
import { createStore } from '~/ide/stores';
import emptyState from '~/ide/components/commit_sidebar/empty_state.vue';
-import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper';
describe('IDE commit panel empty state', () => {
let vm;
diff --git a/spec/frontend/ide/components/commit_sidebar/list_item_spec.js b/spec/frontend/ide/components/commit_sidebar/list_item_spec.js
index 7ce628d4da7..baa25a11c2a 100644
--- a/spec/frontend/ide/components/commit_sidebar/list_item_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/list_item_spec.js
@@ -41,7 +41,7 @@ describe('Multi-file editor commit sidebar list item', () => {
expect(findPathText()).toContain(f.path);
});
- it('correctly renders renamed entries', done => {
+ it('correctly renders renamed entries', (done) => {
Vue.set(vm.file, 'prevName', 'Old name');
vm.$nextTick()
@@ -52,7 +52,7 @@ describe('Multi-file editor commit sidebar list item', () => {
.catch(done.fail);
});
- it('correctly renders entry, the name of which did not change after rename (as within a folder)', done => {
+ it('correctly renders entry, the name of which did not change after rename (as within a folder)', (done) => {
Vue.set(vm.file, 'prevName', f.name);
vm.$nextTick()
@@ -63,7 +63,7 @@ describe('Multi-file editor commit sidebar list item', () => {
.catch(done.fail);
});
- it('opens a closed file in the editor when clicking the file path', done => {
+ it('opens a closed file in the editor when clicking the file path', (done) => {
jest.spyOn(vm, 'openPendingTab');
jest.spyOn(router, 'push').mockImplementation(() => {});
@@ -77,7 +77,7 @@ describe('Multi-file editor commit sidebar list item', () => {
});
});
- it('calls updateViewer with diff when clicking file', done => {
+ it('calls updateViewer with diff when clicking file', (done) => {
jest.spyOn(vm, 'openFileInEditor');
jest.spyOn(vm, 'updateViewer');
jest.spyOn(router, 'push').mockImplementation(() => {});
@@ -134,7 +134,7 @@ describe('Multi-file editor commit sidebar list item', () => {
expect(vm.$el.querySelector('.is-active')).toBe(null);
});
- it('adds active class when keys match', done => {
+ it('adds active class when keys match', (done) => {
vm.keyPrefix = 'staged';
vm.$nextTick(() => {
diff --git a/spec/frontend/ide/components/commit_sidebar/list_spec.js b/spec/frontend/ide/components/commit_sidebar/list_spec.js
index 636dfbf0b2a..898ec4bebce 100644
--- a/spec/frontend/ide/components/commit_sidebar/list_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/list_spec.js
@@ -31,7 +31,7 @@ describe('Multi-file editor commit sidebar list', () => {
});
describe('with a list of files', () => {
- beforeEach(done => {
+ beforeEach((done) => {
const f = file('file name');
f.changed = true;
vm.fileList.push(f);
diff --git a/spec/frontend/ide/components/commit_sidebar/message_field_spec.js b/spec/frontend/ide/components/commit_sidebar/message_field_spec.js
index d6ea8b9a4bd..1514fbc2c3b 100644
--- a/spec/frontend/ide/components/commit_sidebar/message_field_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/message_field_spec.js
@@ -23,7 +23,7 @@ describe('IDE commit message field', () => {
vm.$destroy();
});
- it('adds is-focused class on focus', done => {
+ it('adds is-focused class on focus', (done) => {
vm.$el.querySelector('textarea').focus();
vm.$nextTick(() => {
@@ -33,7 +33,7 @@ describe('IDE commit message field', () => {
});
});
- it('removed is-focused class on blur', done => {
+ it('removed is-focused class on blur', (done) => {
vm.$el.querySelector('textarea').focus();
vm.$nextTick()
@@ -66,7 +66,7 @@ describe('IDE commit message field', () => {
describe('highlights', () => {
describe('subject line', () => {
- it('does not highlight less than 50 characters', done => {
+ it('does not highlight less than 50 characters', (done) => {
vm.text = 'text less than 50 chars';
vm.$nextTick()
@@ -81,7 +81,7 @@ describe('IDE commit message field', () => {
.catch(done.fail);
});
- it('highlights characters over 50 length', done => {
+ it('highlights characters over 50 length', (done) => {
vm.text =
'text less than 50 chars that should not highlighted. text more than 50 should be highlighted';
@@ -102,7 +102,7 @@ describe('IDE commit message field', () => {
});
describe('body text', () => {
- it('does not highlight body text less tan 72 characters', done => {
+ it('does not highlight body text less tan 72 characters', (done) => {
vm.text = 'subject line\nbody content';
vm.$nextTick()
@@ -114,7 +114,7 @@ describe('IDE commit message field', () => {
.catch(done.fail);
});
- it('highlights body text more than 72 characters', done => {
+ it('highlights body text more than 72 characters', (done) => {
vm.text =
'subject line\nbody content that will be highlighted when it is more than 72 characters in length';
@@ -128,7 +128,7 @@ describe('IDE commit message field', () => {
.catch(done.fail);
});
- it('highlights body text & subject line', done => {
+ it('highlights body text & subject line', (done) => {
vm.text =
'text less than 50 chars that should not highlighted\nbody content that will be highlighted when it is more than 72 characters in length';
@@ -147,7 +147,7 @@ describe('IDE commit message field', () => {
});
describe('scrolling textarea', () => {
- it('updates transform of highlights', done => {
+ it('updates transform of highlights', (done) => {
vm.text = 'subject line\n\n\n\n\n\n\n\n\n\n\nbody content';
vm.$nextTick()
diff --git a/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js b/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js
index 7cbf5ebc61a..50da64abbbe 100644
--- a/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js
@@ -17,7 +17,7 @@ describe('create new MR checkbox', () => {
] = { foo: 'bar' };
};
- const setPermissions = permissions => {
+ const setPermissions = (permissions) => {
store.state.projects[store.state.currentProjectId].userPermissions = permissions;
};
@@ -33,7 +33,7 @@ describe('create new MR checkbox', () => {
vm.$store.state.currentBranchId = currentBranchId;
store.state.projects.abcproject.branches[currentBranchId] = branches.find(
- branch => branch.name === currentBranchId,
+ (branch) => branch.name === currentBranchId,
);
return vm.$mount();
@@ -69,7 +69,7 @@ describe('create new MR checkbox', () => {
expect(vm.$el.textContent).not.toBe('');
});
- it('has new MR', done => {
+ it('has new MR', (done) => {
setMR();
vm.$nextTick()
@@ -93,7 +93,7 @@ describe('create new MR checkbox', () => {
expect(vm.$el.textContent).toBe('');
});
- it('has new MR', done => {
+ it('has new MR', (done) => {
setMR();
vm.$nextTick()
@@ -118,7 +118,7 @@ describe('create new MR checkbox', () => {
expect(vm.$el.textContent).not.toBe('');
});
- it('is rendered if MR exists', done => {
+ it('is rendered if MR exists', (done) => {
setMR();
vm.$nextTick()
@@ -141,7 +141,7 @@ describe('create new MR checkbox', () => {
expect(vm.$el.textContent).not.toBe('');
});
- it('is hidden if MR exists', done => {
+ it('is hidden if MR exists', (done) => {
setMR();
vm.$nextTick()
@@ -165,7 +165,7 @@ describe('create new MR checkbox', () => {
expect(vm.$el.textContent).not.toBe('');
});
- it('is hidden if MR exists', done => {
+ it('is hidden if MR exists', (done) => {
setMR();
vm.$nextTick()
diff --git a/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js b/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js
index bf61f4bbe77..73d811f99b8 100644
--- a/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js
@@ -7,7 +7,7 @@ describe('IDE commit sidebar radio group', () => {
let vm;
let store;
- beforeEach(done => {
+ beforeEach((done) => {
store = createStore();
const Component = Vue.extend(radioGroup);
@@ -33,7 +33,7 @@ describe('IDE commit sidebar radio group', () => {
expect(vm.$el.textContent).toContain('test');
});
- it('uses slot if label is not present', done => {
+ it('uses slot if label is not present', (done) => {
vm.$destroy();
vm = new Vue({
@@ -41,7 +41,7 @@ describe('IDE commit sidebar radio group', () => {
radioGroup,
},
store,
- render: createElement =>
+ render: (createElement) =>
createElement('radio-group', { props: { value: '1' } }, 'Testing slot'),
});
@@ -54,7 +54,7 @@ describe('IDE commit sidebar radio group', () => {
});
});
- it('updates store when changing radio button', done => {
+ it('updates store when changing radio button', (done) => {
vm.$el.querySelector('input').dispatchEvent(new Event('change'));
Vue.nextTick(() => {
@@ -65,7 +65,7 @@ describe('IDE commit sidebar radio group', () => {
});
describe('with input', () => {
- beforeEach(done => {
+ beforeEach((done) => {
vm.$destroy();
const Component = Vue.extend(radioGroup);
@@ -89,7 +89,7 @@ describe('IDE commit sidebar radio group', () => {
expect(vm.$el.querySelector('.form-control')).not.toBeNull();
});
- it('hides input when commitAction doesnt match value', done => {
+ it('hides input when commitAction doesnt match value', (done) => {
store.state.commit.commitAction = '2';
Vue.nextTick(() => {
@@ -98,7 +98,7 @@ describe('IDE commit sidebar radio group', () => {
});
});
- it('updates branch name in store on input', done => {
+ it('updates branch name in store on input', (done) => {
const input = vm.$el.querySelector('.form-control');
input.value = 'testing-123';
input.dispatchEvent(new Event('input'));
diff --git a/spec/frontend/ide/components/commit_sidebar/success_message_spec.js b/spec/frontend/ide/components/commit_sidebar/success_message_spec.js
index db13c90fbb9..b116321efb3 100644
--- a/spec/frontend/ide/components/commit_sidebar/success_message_spec.js
+++ b/spec/frontend/ide/components/commit_sidebar/success_message_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
+import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
import { createStore } from '~/ide/stores';
import successMessage from '~/ide/components/commit_sidebar/success_message.vue';
-import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper';
describe('IDE commit panel successful commit state', () => {
let vm;
@@ -23,7 +23,7 @@ describe('IDE commit panel successful commit state', () => {
vm.$destroy();
});
- it('renders last commit message when it exists', done => {
+ it('renders last commit message when it exists', (done) => {
vm.$store.state.lastCommitMsg = 'testing commit message';
Vue.nextTick(() => {
diff --git a/spec/frontend/ide/components/error_message_spec.js b/spec/frontend/ide/components/error_message_spec.js
index 8b7e7da3b51..fa6816d3546 100644
--- a/spec/frontend/ide/components/error_message_spec.js
+++ b/spec/frontend/ide/components/error_message_spec.js
@@ -10,7 +10,7 @@ describe('IDE error message component', () => {
let wrapper;
const setErrorMessageMock = jest.fn();
- const createComponent = messageProps => {
+ const createComponent = (messageProps) => {
const fakeStore = new Vuex.Store({
actions: { setErrorMessage: setErrorMessageMock },
});
@@ -103,7 +103,7 @@ describe('IDE error message component', () => {
let resolveAction;
actionMock.mockImplementation(
() =>
- new Promise(resolve => {
+ new Promise((resolve) => {
resolveAction = resolve;
}),
);
diff --git a/spec/frontend/ide/components/file_row_extra_spec.js b/spec/frontend/ide/components/file_row_extra_spec.js
index 2a106ad37c0..275b98bc154 100644
--- a/spec/frontend/ide/components/file_row_extra_spec.js
+++ b/spec/frontend/ide/components/file_row_extra_spec.js
@@ -45,15 +45,16 @@ describe('IDE extra file row component', () => {
expect(vm.folderChangesTooltip).toBe(undefined);
});
- [{ input: 1, output: '1 changed file' }, { input: 2, output: '2 changed files' }].forEach(
- ({ input, output }) => {
- it('returns changed files count if changes count is not 0', () => {
- changesCount = input;
-
- expect(vm.folderChangesTooltip).toBe(output);
- });
- },
- );
+ [
+ { input: 1, output: '1 changed file' },
+ { input: 2, output: '2 changed files' },
+ ].forEach(({ input, output }) => {
+ it('returns changed files count if changes count is not 0', () => {
+ changesCount = input;
+
+ expect(vm.folderChangesTooltip).toBe(output);
+ });
+ });
});
describe('show tree changes count', () => {
@@ -69,7 +70,7 @@ describe('IDE extra file row component', () => {
expect(vm.$el.querySelector('.ide-tree-changes')).toBe(null);
});
- it('does not show when tree is open', done => {
+ it('does not show when tree is open', (done) => {
vm.file.type = 'tree';
vm.file.opened = true;
changesCount = 1;
@@ -81,7 +82,7 @@ describe('IDE extra file row component', () => {
});
});
- it('shows for trees with changes', done => {
+ it('shows for trees with changes', (done) => {
vm.file.type = 'tree';
vm.file.opened = false;
changesCount = 1;
@@ -99,7 +100,7 @@ describe('IDE extra file row component', () => {
expect(vm.$el.querySelector('.file-changed-icon')).toBe(null);
});
- it('shows when file is changed', done => {
+ it('shows when file is changed', (done) => {
vm.file.changed = true;
vm.$nextTick(() => {
@@ -109,7 +110,7 @@ describe('IDE extra file row component', () => {
});
});
- it('shows when file is staged', done => {
+ it('shows when file is staged', (done) => {
vm.file.staged = true;
vm.$nextTick(() => {
@@ -119,7 +120,7 @@ describe('IDE extra file row component', () => {
});
});
- it('shows when file is a tempFile', done => {
+ it('shows when file is a tempFile', (done) => {
vm.file.tempFile = true;
vm.$nextTick(() => {
@@ -129,7 +130,7 @@ describe('IDE extra file row component', () => {
});
});
- it('shows when file is renamed', done => {
+ it('shows when file is renamed', (done) => {
vm.file.prevPath = 'original-file';
vm.$nextTick(() => {
@@ -139,7 +140,7 @@ describe('IDE extra file row component', () => {
});
});
- it('hides when file is renamed', done => {
+ it('hides when file is renamed', (done) => {
vm.file.prevPath = 'original-file';
vm.file.type = 'tree';
@@ -156,7 +157,7 @@ describe('IDE extra file row component', () => {
expect(vm.$el.querySelector('[data-testid="git-merge-icon"]')).toBe(null);
});
- it('shows when a merge request change', done => {
+ it('shows when a merge request change', (done) => {
vm.file.mrChange = true;
vm.$nextTick(() => {
diff --git a/spec/frontend/ide/components/file_templates/bar_spec.js b/spec/frontend/ide/components/file_templates/bar_spec.js
index 5a33837fb14..158995c9c9c 100644
--- a/spec/frontend/ide/components/file_templates/bar_spec.js
+++ b/spec/frontend/ide/components/file_templates/bar_spec.js
@@ -46,7 +46,7 @@ describe('IDE file templates bar component', () => {
});
describe('template dropdown', () => {
- beforeEach(done => {
+ beforeEach((done) => {
vm.$store.state.fileTemplates.templates = [
{
name: 'test',
@@ -67,10 +67,7 @@ describe('IDE file templates bar component', () => {
it('calls fetchTemplate on click', () => {
jest.spyOn(vm, 'fetchTemplate').mockImplementation();
- vm.$el
- .querySelectorAll('.dropdown-content')[1]
- .querySelector('button')
- .click();
+ vm.$el.querySelectorAll('.dropdown-content')[1].querySelector('button').click();
expect(vm.fetchTemplate).toHaveBeenCalledWith({
name: 'test',
@@ -78,7 +75,7 @@ describe('IDE file templates bar component', () => {
});
});
- it('shows undo button if updateSuccess is true', done => {
+ it('shows undo button if updateSuccess is true', (done) => {
vm.$store.state.fileTemplates.updateSuccess = true;
vm.$nextTick(() => {
@@ -96,7 +93,7 @@ describe('IDE file templates bar component', () => {
expect(vm.undoFileTemplate).toHaveBeenCalled();
});
- it('calls setSelectedTemplateType if activeFile name matches a template', done => {
+ it('calls setSelectedTemplateType if activeFile name matches a template', (done) => {
const fileName = '.gitlab-ci.yml';
jest.spyOn(vm, 'setSelectedTemplateType').mockImplementation(() => {});
diff --git a/spec/frontend/ide/components/file_templates/dropdown_spec.js b/spec/frontend/ide/components/file_templates/dropdown_spec.js
index 3cffbc3362f..628580103a4 100644
--- a/spec/frontend/ide/components/file_templates/dropdown_spec.js
+++ b/spec/frontend/ide/components/file_templates/dropdown_spec.js
@@ -109,7 +109,7 @@ describe('IDE file templates dropdown component', () => {
});
const items = findItemButtons();
- expect(items.wrappers.map(x => x.text())).toEqual(templates.map(x => x.name));
+ expect(items.wrappers.map((x) => x.text())).toEqual(templates.map((x) => x.name));
});
it('searches template data', () => {
@@ -124,7 +124,7 @@ describe('IDE file templates dropdown component', () => {
const items = findItemButtons();
expect(items.length).toBe(matches.length);
- expect(items.wrappers.map(x => x.text())).toEqual(matches);
+ expect(items.wrappers.map((x) => x.text())).toEqual(matches);
});
});
@@ -151,7 +151,7 @@ describe('IDE file templates dropdown component', () => {
const items = findItemButtons();
expect(items.length).toBe(data.length);
- expect(items.wrappers.map(x => x.text())).toEqual(data.map(x => x.name));
+ expect(items.wrappers.map((x) => x.text())).toEqual(data.map((x) => x.name));
});
it('renders input when `searchable` is true', () => {
@@ -169,7 +169,7 @@ describe('IDE file templates dropdown component', () => {
const items = findItemButtons();
expect(items.length).toBe(matches.length);
- expect(items.wrappers.map(x => x.text())).toEqual(matches);
+ expect(items.wrappers.map((x) => x.text())).toEqual(matches);
});
});
});
diff --git a/spec/frontend/ide/components/ide_review_spec.js b/spec/frontend/ide/components/ide_review_spec.js
index bcc98669427..37f34a96495 100644
--- a/spec/frontend/ide/components/ide_review_spec.js
+++ b/spec/frontend/ide/components/ide_review_spec.js
@@ -1,11 +1,11 @@
import Vue from 'vue';
import Vuex from 'vuex';
import { createLocalVue, mount } from '@vue/test-utils';
+import { trimText } from 'helpers/text_helper';
+import { keepAlive } from 'helpers/keep_alive_component_helper';
import IdeReview from '~/ide/components/ide_review.vue';
import EditorModeDropdown from '~/ide/components/editor_mode_dropdown.vue';
import { createStore } from '~/ide/stores';
-import { trimText } from '../../helpers/text_helper';
-import { keepAlive } from '../../helpers/keep_alive_component_helper';
import { file } from '../helpers';
import { projectData } from '../mock_data';
diff --git a/spec/frontend/ide/components/ide_sidebar_nav_spec.js b/spec/frontend/ide/components/ide_sidebar_nav_spec.js
index 49d476b56e4..6b4cb9bd03d 100644
--- a/spec/frontend/ide/components/ide_sidebar_nav_spec.js
+++ b/spec/frontend/ide/components/ide_sidebar_nav_spec.js
@@ -48,7 +48,7 @@ describe('ide/components/ide_sidebar_nav', () => {
const findButtons = () => wrapper.findAll('li button');
const findButtonsData = () =>
- findButtons().wrappers.map(button => {
+ findButtons().wrappers.map((button) => {
return {
title: button.attributes('title'),
ariaLabel: button.attributes('aria-label'),
@@ -58,10 +58,7 @@ describe('ide/components/ide_sidebar_nav', () => {
tooltip: getBinding(button.element, 'tooltip').value,
};
});
- const clickTab = () =>
- findButtons()
- .at(TEST_CURRENT_INDEX)
- .trigger('click');
+ const clickTab = () => findButtons().at(TEST_CURRENT_INDEX).trigger('click');
describe.each`
isOpen | side | otherSide | classes | classesObj | emitEvent | emitArg
diff --git a/spec/frontend/ide/components/ide_spec.js b/spec/frontend/ide/components/ide_spec.js
index 315298eaf26..805fa898611 100644
--- a/spec/frontend/ide/components/ide_spec.js
+++ b/spec/frontend/ide/components/ide_spec.js
@@ -25,7 +25,7 @@ describe('WebIDE', () => {
tree: [],
loading: false,
};
- Object.keys(state).forEach(key => {
+ Object.keys(state).forEach((key) => {
store.state[key] = state[key];
});
diff --git a/spec/frontend/ide/components/ide_status_bar_spec.js b/spec/frontend/ide/components/ide_status_bar_spec.js
index bc8144f544c..47506bb87e8 100644
--- a/spec/frontend/ide/components/ide_status_bar_spec.js
+++ b/spec/frontend/ide/components/ide_status_bar_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import _ from 'lodash';
import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
-import { TEST_HOST } from '../../helpers/test_constants';
+import { TEST_HOST } from 'helpers/test_constants';
import { createStore } from '~/ide/stores';
import IdeStatusBar from '~/ide/components/ide_status_bar.vue';
import { rightSidebarViews } from '~/ide/constants';
@@ -73,7 +73,7 @@ describe('ideStatusBar', () => {
});
describe('pipeline status', () => {
- it('opens right sidebar on clicking icon', done => {
+ it('opens right sidebar on clicking icon', (done) => {
jest.spyOn(vm, 'openRightPane').mockImplementation(() => {});
Vue.set(vm.$store.state.pipelines, 'latestPipeline', {
details: {
diff --git a/spec/frontend/ide/components/ide_status_mr_spec.js b/spec/frontend/ide/components/ide_status_mr_spec.js
index 4d9ad61201d..ac1be4b21c0 100644
--- a/spec/frontend/ide/components/ide_status_mr_spec.js
+++ b/spec/frontend/ide/components/ide_status_mr_spec.js
@@ -9,7 +9,7 @@ const TEST_URL = `${TEST_HOST}merge-requests/9001`;
describe('ide/components/ide_status_mr', () => {
let wrapper;
- const createComponent = props => {
+ const createComponent = (props) => {
wrapper = shallowMount(IdeStatusMr, {
propsData: props,
});
diff --git a/spec/frontend/ide/components/ide_tree_list_spec.js b/spec/frontend/ide/components/ide_tree_list_spec.js
index dd57a5c5f4d..c8153ea339e 100644
--- a/spec/frontend/ide/components/ide_tree_list_spec.js
+++ b/spec/frontend/ide/components/ide_tree_list_spec.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
+import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
import IdeTreeList from '~/ide/components/ide_tree_list.vue';
import { createStore } from '~/ide/stores';
-import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
import { file } from '../helpers';
import { projectData } from '../mock_data';
@@ -41,7 +41,7 @@ describe('IDE tree list', () => {
vm.$mount();
});
- it('renders loading indicator', done => {
+ it('renders loading indicator', (done) => {
store.state.trees['abcproject/master'].loading = true;
vm.$nextTick(() => {
diff --git a/spec/frontend/ide/components/ide_tree_spec.js b/spec/frontend/ide/components/ide_tree_spec.js
index ad00dec2e48..c5934b032c4 100644
--- a/spec/frontend/ide/components/ide_tree_spec.js
+++ b/spec/frontend/ide/components/ide_tree_spec.js
@@ -1,9 +1,9 @@
import Vue from 'vue';
import Vuex from 'vuex';
import { mount, createLocalVue } from '@vue/test-utils';
+import { keepAlive } from 'helpers/keep_alive_component_helper';
import IdeTree from '~/ide/components/ide_tree.vue';
import { createStore } from '~/ide/stores';
-import { keepAlive } from '../../helpers/keep_alive_component_helper';
import { file } from '../helpers';
import { projectData } from '../mock_data';
diff --git a/spec/frontend/ide/components/jobs/detail/description_spec.js b/spec/frontend/ide/components/jobs/detail/description_spec.js
index 5554738336a..786a7661d97 100644
--- a/spec/frontend/ide/components/jobs/detail/description_spec.js
+++ b/spec/frontend/ide/components/jobs/detail/description_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
+import mountComponent from 'helpers/vue_mount_component_helper';
import Description from '~/ide/components/jobs/detail/description.vue';
-import mountComponent from '../../../../helpers/vue_mount_component_helper';
import { jobs } from '../../../mock_data';
describe('IDE job description', () => {
diff --git a/spec/frontend/ide/components/jobs/detail/scroll_button_spec.js b/spec/frontend/ide/components/jobs/detail/scroll_button_spec.js
index 57174181a3d..b323ad8320c 100644
--- a/spec/frontend/ide/components/jobs/detail/scroll_button_spec.js
+++ b/spec/frontend/ide/components/jobs/detail/scroll_button_spec.js
@@ -5,7 +5,7 @@ import ScrollButton from '~/ide/components/jobs/detail/scroll_button.vue';
describe('IDE job log scroll button', () => {
let wrapper;
- const createComponent = props => {
+ const createComponent = (props) => {
wrapper = shallowMount(ScrollButton, {
propsData: {
direction: 'up',
diff --git a/spec/frontend/ide/components/jobs/detail_spec.js b/spec/frontend/ide/components/jobs/detail_spec.js
index 496d8284fdd..79ac0a8122a 100644
--- a/spec/frontend/ide/components/jobs/detail_spec.js
+++ b/spec/frontend/ide/components/jobs/detail_spec.js
@@ -1,8 +1,8 @@
import Vue from 'vue';
import { TEST_HOST } from 'helpers/test_constants';
+import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
import JobDetail from '~/ide/components/jobs/detail.vue';
import { createStore } from '~/ide/stores';
-import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper';
import { jobs } from '../../mock_data';
describe('IDE jobs detail view', () => {
@@ -48,7 +48,7 @@ describe('IDE jobs detail view', () => {
expect(vm.$el.querySelector('.bash').textContent).toContain('testing');
});
- it('renders empty message output', done => {
+ it('renders empty message output', (done) => {
vm.$store.state.pipelines.detailJob.output = '';
vm.$nextTick(() => {
@@ -68,7 +68,7 @@ describe('IDE jobs detail view', () => {
expect(vm.$el.querySelector('.bash').style.display).toBe('none');
});
- it('hide loading icon when isLoading is false', done => {
+ it('hide loading icon when isLoading is false', (done) => {
vm.$store.state.pipelines.detailJob.isLoading = false;
vm.$nextTick(() => {
diff --git a/spec/frontend/ide/components/jobs/item_spec.js b/spec/frontend/ide/components/jobs/item_spec.js
index 93c01640b54..7343fc80a03 100644
--- a/spec/frontend/ide/components/jobs/item_spec.js
+++ b/spec/frontend/ide/components/jobs/item_spec.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
+import mountComponent from 'helpers/vue_mount_component_helper';
import JobItem from '~/ide/components/jobs/item.vue';
-import mountComponent from '../../../helpers/vue_mount_component_helper';
import { jobs } from '../../mock_data';
describe('IDE jobs item', () => {
@@ -27,7 +27,7 @@ describe('IDE jobs item', () => {
expect(vm.$el.querySelector('[data-testid="status_success_borderless-icon"]')).not.toBe(null);
});
- it('does not render view logs button if not started', done => {
+ it('does not render view logs button if not started', (done) => {
vm.job.started = false;
vm.$nextTick(() => {
diff --git a/spec/frontend/ide/components/jobs/list_spec.js b/spec/frontend/ide/components/jobs/list_spec.js
index e821a585e18..5c5c6602374 100644
--- a/spec/frontend/ide/components/jobs/list_spec.js
+++ b/spec/frontend/ide/components/jobs/list_spec.js
@@ -36,7 +36,7 @@ describe('IDE stages list', () => {
status: { icon: 'status_success' },
}));
- const createComponent = props => {
+ const createComponent = (props) => {
wrapper = shallowMount(StageList, {
propsData: {
...defaultProps,
@@ -48,7 +48,7 @@ describe('IDE stages list', () => {
};
afterEach(() => {
- Object.values(storeActions).forEach(actionMock => actionMock.mockClear());
+ Object.values(storeActions).forEach((actionMock) => actionMock.mockClear());
});
afterAll(() => {
diff --git a/spec/frontend/ide/components/jobs/stage_spec.js b/spec/frontend/ide/components/jobs/stage_spec.js
index 3a47571ee13..e80215b9d13 100644
--- a/spec/frontend/ide/components/jobs/stage_spec.js
+++ b/spec/frontend/ide/components/jobs/stage_spec.js
@@ -20,7 +20,7 @@ describe('IDE pipeline stage', () => {
const findHeader = () => wrapper.find({ ref: 'cardHeader' });
const findJobList = () => wrapper.find({ ref: 'jobList' });
- const createComponent = props => {
+ const createComponent = (props) => {
wrapper = shallowMount(Stage, {
propsData: {
...defaultProps,
@@ -60,10 +60,7 @@ describe('IDE pipeline stage', () => {
it('emits clickViewLog entity with job', () => {
const [job] = defaultProps.stage.jobs;
createComponent();
- wrapper
- .findAll(Item)
- .at(0)
- .vm.$emit('clickViewLog', job);
+ wrapper.findAll(Item).at(0).vm.$emit('clickViewLog', job);
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().clickViewLog[0][0]).toBe(job);
});
diff --git a/spec/frontend/ide/components/merge_requests/list_spec.js b/spec/frontend/ide/components/merge_requests/list_spec.js
index 80dcd861451..f0ac852fa67 100644
--- a/spec/frontend/ide/components/merge_requests/list_spec.js
+++ b/spec/frontend/ide/components/merge_requests/list_spec.js
@@ -82,9 +82,7 @@ describe('IDE merge requests list', () => {
return wrapper.vm
.$nextTick()
.then(() => {
- findSearchTypeButtons()
- .at(0)
- .trigger('click');
+ findSearchTypeButtons().at(0).trigger('click');
return wrapper.vm.$nextTick();
})
.then(() => {
@@ -153,8 +151,8 @@ describe('IDE merge requests list', () => {
it('shows search types', () => {
const buttons = findSearchTypeButtons();
- expect(buttons.wrappers.map(x => x.text().trim())).toEqual(
- wrapper.vm.$options.searchTypes.map(x => x.label),
+ expect(buttons.wrappers.map((x) => x.text().trim())).toEqual(
+ wrapper.vm.$options.searchTypes.map((x) => x.label),
);
});
@@ -168,9 +166,7 @@ describe('IDE merge requests list', () => {
describe('with search type', () => {
beforeEach(() => {
- findSearchTypeButtons()
- .at(0)
- .trigger('click');
+ findSearchTypeButtons().at(0).trigger('click');
return wrapper.vm
.$nextTick()
diff --git a/spec/frontend/ide/components/nav_dropdown_button_spec.js b/spec/frontend/ide/components/nav_dropdown_button_spec.js
index c98aa313f40..a02bfa5c391 100644
--- a/spec/frontend/ide/components/nav_dropdown_button_spec.js
+++ b/spec/frontend/ide/components/nav_dropdown_button_spec.js
@@ -23,7 +23,7 @@ describe('NavDropdown', () => {
vm.$mount();
};
- const findIcon = name => vm.$el.querySelector(`[data-testid="${name}-icon"]`);
+ const findIcon = (name) => vm.$el.querySelector(`[data-testid="${name}-icon"]`);
const findMRIcon = () => findIcon('merge-request');
const findBranchIcon = () => findIcon('branch');
@@ -36,7 +36,7 @@ describe('NavDropdown', () => {
expect(trimText(vm.$el.textContent)).toEqual('- -');
});
- it('renders branch name, if state has currentBranchId', done => {
+ it('renders branch name, if state has currentBranchId', (done) => {
vm.$store.state.currentBranchId = TEST_BRANCH_ID;
vm.$nextTick()
@@ -47,7 +47,7 @@ describe('NavDropdown', () => {
.catch(done.fail);
});
- it('renders mr id, if state has currentMergeRequestId', done => {
+ it('renders mr id, if state has currentMergeRequestId', (done) => {
vm.$store.state.currentMergeRequestId = TEST_MR_ID;
vm.$nextTick()
@@ -58,7 +58,7 @@ describe('NavDropdown', () => {
.catch(done.fail);
});
- it('renders branch and mr, if state has both', done => {
+ it('renders branch and mr, if state has both', (done) => {
vm.$store.state.currentBranchId = TEST_BRANCH_ID;
vm.$store.state.currentMergeRequestId = TEST_MR_ID;
diff --git a/spec/frontend/ide/components/nav_dropdown_spec.js b/spec/frontend/ide/components/nav_dropdown_spec.js
index 2f91ab7af0a..12a1a4c8013 100644
--- a/spec/frontend/ide/components/nav_dropdown_spec.js
+++ b/spec/frontend/ide/components/nav_dropdown_spec.js
@@ -39,7 +39,7 @@ describe('IDE NavDropdown', () => {
});
};
- const findIcon = name => wrapper.find(`[data-testid="${name}-icon"]`);
+ const findIcon = (name) => wrapper.find(`[data-testid="${name}-icon"]`);
const findMRIcon = () => findIcon('merge-request');
const findNavForm = () => wrapper.find('.ide-nav-form');
const showDropdown = () => {
@@ -58,7 +58,7 @@ describe('IDE NavDropdown', () => {
expect(findNavForm().exists()).toBe(false);
});
- it('renders nav form when show.bs.dropdown', done => {
+ it('renders nav form when show.bs.dropdown', (done) => {
showDropdown();
wrapper.vm
@@ -70,7 +70,7 @@ describe('IDE NavDropdown', () => {
.catch(done.fail);
});
- it('destroys nav form when closed', done => {
+ it('destroys nav form when closed', (done) => {
showDropdown();
hideDropdown();
diff --git a/spec/frontend/ide/components/new_dropdown/button_spec.js b/spec/frontend/ide/components/new_dropdown/button_spec.js
index 66317296ee9..32fa2babcdb 100644
--- a/spec/frontend/ide/components/new_dropdown/button_spec.js
+++ b/spec/frontend/ide/components/new_dropdown/button_spec.js
@@ -37,7 +37,7 @@ describe('IDE new entry dropdown button component', () => {
expect(vm.$emit).toHaveBeenCalledWith('click');
});
- it('hides label if showLabel is false', done => {
+ it('hides label if showLabel is false', (done) => {
vm.showLabel = false;
vm.$nextTick(() => {
@@ -52,7 +52,7 @@ describe('IDE new entry dropdown button component', () => {
expect(vm.tooltipTitle).toBe('');
});
- it('returns label', done => {
+ it('returns label', (done) => {
vm.showLabel = false;
vm.$nextTick(() => {
diff --git a/spec/frontend/ide/components/new_dropdown/index_spec.js b/spec/frontend/ide/components/new_dropdown/index_spec.js
index c6cebf36de3..793d950b3e0 100644
--- a/spec/frontend/ide/components/new_dropdown/index_spec.js
+++ b/spec/frontend/ide/components/new_dropdown/index_spec.js
@@ -57,7 +57,7 @@ describe('new dropdown component', () => {
});
describe('isOpen', () => {
- it('scrolls dropdown into view', done => {
+ it('scrolls dropdown into view', (done) => {
jest.spyOn(vm.$refs.dropdownMenu, 'scrollIntoView').mockImplementation(() => {});
vm.isOpen = true;
diff --git a/spec/frontend/ide/components/new_dropdown/modal_spec.js b/spec/frontend/ide/components/new_dropdown/modal_spec.js
index ea8ba24c9d0..06434081e39 100644
--- a/spec/frontend/ide/components/new_dropdown/modal_spec.js
+++ b/spec/frontend/ide/components/new_dropdown/modal_spec.js
@@ -19,7 +19,7 @@ describe('new file modal component', () => {
${'tree'} | ${'Create new directory'} | ${'Create directory'} | ${false}
${'blob'} | ${'Create new file'} | ${'Create file'} | ${true}
`('$entryType', ({ entryType, modalTitle, btnTitle, showsFileTemplates }) => {
- beforeEach(done => {
+ beforeEach((done) => {
const store = createStore();
vm = createComponentWithStore(Component, store).$mount();
diff --git a/spec/frontend/ide/components/new_dropdown/upload_spec.js b/spec/frontend/ide/components/new_dropdown/upload_spec.js
index 3f3784dbb3a..7303f81aad0 100644
--- a/spec/frontend/ide/components/new_dropdown/upload_spec.js
+++ b/spec/frontend/ide/components/new_dropdown/upload_spec.js
@@ -62,15 +62,15 @@ describe('new dropdown upload', () => {
result: 'base64,8PDw8A==', // ðððð
};
- const textFile = new File(['plain text'], 'textFile');
- const binaryFile = new File(['😺'], 'binaryFile');
+ const textFile = new File(['plain text'], 'textFile', { type: 'test/mime-text' });
+ const binaryFile = new File(['😺'], 'binaryFile', { type: 'test/mime-binary' });
beforeEach(() => {
jest.spyOn(FileReader.prototype, 'readAsText');
});
- it('calls readAsText and creates file in plain text (without encoding) if the file content is plain text', done => {
- const waitForCreate = new Promise(resolve => vm.$on('create', resolve));
+ it('calls readAsText and creates file in plain text (without encoding) if the file content is plain text', (done) => {
+ const waitForCreate = new Promise((resolve) => vm.$on('create', resolve));
vm.createFile(textTarget, textFile);
@@ -83,6 +83,7 @@ describe('new dropdown upload', () => {
type: 'blob',
content: 'plain text',
rawPath: '',
+ mimeType: 'test/mime-text',
});
})
.then(done)
@@ -99,6 +100,7 @@ describe('new dropdown upload', () => {
type: 'blob',
content: 'ðððð',
rawPath: 'blob:https://gitlab.com/048c7ac1-98de-4a37-ab1b-0206d0ea7e1b',
+ mimeType: 'test/mime-binary',
});
});
});
diff --git a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js
index bb9ba32a699..c3da2a46858 100644
--- a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js
+++ b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js
@@ -15,7 +15,7 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => {
const width = 350;
const fakeComponentName = 'fake-component';
- const createComponent = props => {
+ const createComponent = (props) => {
wrapper = shallowMount(CollapsibleSidebar, {
localVue,
store,
@@ -47,7 +47,7 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => {
beforeEach(() => {
const FakeComponent = localVue.component(fakeComponentName, {
- render: () => {},
+ render: () => null,
});
fakeView = {
diff --git a/spec/frontend/ide/components/panes/right_spec.js b/spec/frontend/ide/components/panes/right_spec.js
index 203d35ed335..57fd0e49e94 100644
--- a/spec/frontend/ide/components/panes/right_spec.js
+++ b/spec/frontend/ide/components/panes/right_spec.js
@@ -14,7 +14,7 @@ describe('ide/components/panes/right.vue', () => {
let wrapper;
let store;
- const createComponent = props => {
+ const createComponent = (props) => {
extendStore(store, document.createElement('div'));
wrapper = shallowMount(RightPane, {
diff --git a/spec/frontend/ide/components/pipelines/list_spec.js b/spec/frontend/ide/components/pipelines/list_spec.js
index c1744fefe20..a1fbfd96c31 100644
--- a/spec/frontend/ide/components/pipelines/list_spec.js
+++ b/spec/frontend/ide/components/pipelines/list_spec.js
@@ -1,4 +1,5 @@
-import { shallowMount, createLocalVue } from '@vue/test-utils';
+import { shallowMount } from '@vue/test-utils';
+import Vue from 'vue';
import Vuex from 'vuex';
import { GlLoadingIcon, GlTab } from '@gitlab/ui';
import { TEST_HOST } from 'helpers/test_constants';
@@ -8,8 +9,7 @@ import JobsList from '~/ide/components/jobs/list.vue';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import IDEServices from '~/ide/services';
-const localVue = createLocalVue();
-localVue.use(Vuex);
+Vue.use(Vuex);
jest.mock('~/ide/services', () => ({
pingUsage: jest.fn(),
@@ -59,9 +59,6 @@ describe('IDE pipelines list', () => {
failedStages: failedStagesGetterMock,
pipelineFailed: () => false,
},
- methods: {
- fetchLatestPipeline: jest.fn(),
- },
},
},
});
@@ -69,7 +66,6 @@ describe('IDE pipelines list', () => {
const createComponent = (state = {}, pipelinesState = {}) => {
wrapper = shallowMount(List, {
- localVue,
store: createStore(state, pipelinesState),
});
};
@@ -165,11 +161,7 @@ describe('IDE pipelines list', () => {
const isLoadingJobs = true;
createComponent({}, { ...withLatestPipelineState, stages, isLoadingJobs });
- const jobProps = wrapper
- .findAll(GlTab)
- .at(0)
- .find(JobsList)
- .props();
+ const jobProps = wrapper.findAll(GlTab).at(0).find(JobsList).props();
expect(jobProps.stages).toBe(stages);
expect(jobProps.loading).toBe(isLoadingJobs);
});
@@ -180,11 +172,7 @@ describe('IDE pipelines list', () => {
const isLoadingJobs = true;
createComponent({}, { ...withLatestPipelineState, isLoadingJobs });
- const jobProps = wrapper
- .findAll(GlTab)
- .at(1)
- .find(JobsList)
- .props();
+ const jobProps = wrapper.findAll(GlTab).at(1).find(JobsList).props();
expect(jobProps.stages).toBe(failedStages);
expect(jobProps.loading).toBe(isLoadingJobs);
});
diff --git a/spec/frontend/ide/components/preview/clientside_spec.js b/spec/frontend/ide/components/preview/clientside_spec.js
index 7b22f75cee4..220982e1fd9 100644
--- a/spec/frontend/ide/components/preview/clientside_spec.js
+++ b/spec/frontend/ide/components/preview/clientside_spec.js
@@ -3,6 +3,7 @@ import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import smooshpack from 'smooshpack';
import Clientside from '~/ide/components/preview/clientside.vue';
+import eventHub from '~/ide/eventhub';
jest.mock('smooshpack', () => ({
Manager: jest.fn(),
@@ -70,6 +71,17 @@ describe('IDE clientside preview', () => {
});
};
+ const createInitializedComponent = () => {
+ createComponent();
+ wrapper.setData({
+ sandpackReady: true,
+ manager: {
+ listener: jest.fn(),
+ updatePreview: jest.fn(),
+ },
+ });
+ };
+
afterEach(() => {
wrapper.destroy();
});
@@ -293,33 +305,33 @@ describe('IDE clientside preview', () => {
});
describe('update', () => {
- beforeEach(() => {
- createComponent();
- wrapper.setData({ sandpackReady: true });
- });
-
it('initializes manager if manager is empty', () => {
createComponent({ getters: { packageJson: dummyPackageJson } });
wrapper.setData({ sandpackReady: true });
wrapper.vm.update();
- jest.advanceTimersByTime(250);
-
return waitForCalls().then(() => {
expect(smooshpack.Manager).toHaveBeenCalled();
});
});
it('calls updatePreview', () => {
- wrapper.setData({
- manager: {
- listener: jest.fn(),
- updatePreview: jest.fn(),
- },
- });
+ createInitializedComponent();
+
wrapper.vm.update();
- jest.advanceTimersByTime(250);
+ expect(wrapper.vm.manager.updatePreview).toHaveBeenCalledWith(wrapper.vm.sandboxOpts);
+ });
+ });
+
+ describe('on ide.files.change event', () => {
+ beforeEach(() => {
+ createInitializedComponent();
+
+ eventHub.$emit('ide.files.change');
+ });
+
+ it('calls updatePreview', () => {
expect(wrapper.vm.manager.updatePreview).toHaveBeenCalledWith(wrapper.vm.sandboxOpts);
});
});
@@ -355,4 +367,18 @@ describe('IDE clientside preview', () => {
});
});
});
+
+ describe('when destroyed', () => {
+ let spy;
+
+ beforeEach(() => {
+ createInitializedComponent();
+ spy = wrapper.vm.manager.updatePreview;
+ wrapper.destroy();
+ });
+
+ it('does not call updatePreview', () => {
+ expect(spy).not.toHaveBeenCalled();
+ });
+ });
});
diff --git a/spec/frontend/ide/components/repo_commit_section_spec.js b/spec/frontend/ide/components/repo_commit_section_spec.js
index 096079308cd..e91debee4ca 100644
--- a/spec/frontend/ide/components/repo_commit_section_spec.js
+++ b/spec/frontend/ide/components/repo_commit_section_spec.js
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils';
+import { keepAlive } from 'helpers/keep_alive_component_helper';
import { createStore } from '~/ide/stores';
import { createRouter } from '~/ide/ide_router';
-import { keepAlive } from '../../helpers/keep_alive_component_helper';
import RepoCommitSection from '~/ide/components/repo_commit_section.vue';
import EmptyState from '~/ide/components/commit_sidebar/empty_state.vue';
import { stageKeys } from '~/ide/constants';
@@ -32,7 +32,7 @@ describe('RepoCommitSection', () => {
},
};
- const files = [file('file1'), file('file2')].map(f =>
+ const files = [file('file1'), file('file2')].map((f) =>
Object.assign(f, {
type: 'blob',
content: 'orginal content',
@@ -42,7 +42,7 @@ describe('RepoCommitSection', () => {
store.state.currentBranch = 'master';
store.state.changedFiles = [];
store.state.stagedFiles = [{ ...files[0] }, { ...files[1] }];
- store.state.stagedFiles.forEach(f =>
+ store.state.stagedFiles.forEach((f) =>
Object.assign(f, {
changed: true,
staged: true,
@@ -50,7 +50,7 @@ describe('RepoCommitSection', () => {
}),
);
- files.forEach(f => {
+ files.forEach((f) => {
store.state.entries[f.path] = f;
});
}
@@ -77,18 +77,8 @@ describe('RepoCommitSection', () => {
});
it('renders no changes text', () => {
- expect(
- wrapper
- .find(EmptyState)
- .text()
- .trim(),
- ).toContain('No changes');
- expect(
- wrapper
- .find(EmptyState)
- .find('img')
- .attributes('src'),
- ).toBe(TEST_NO_CHANGES_SVG);
+ expect(wrapper.find(EmptyState).text().trim()).toContain('No changes');
+ expect(wrapper.find(EmptyState).find('img').attributes('src')).toBe(TEST_NO_CHANGES_SVG);
});
});
@@ -115,9 +105,9 @@ describe('RepoCommitSection', () => {
const allFiles = store.state.changedFiles.concat(store.state.stagedFiles);
const changedFileNames = wrapper
.findAll('.multi-file-commit-list > li')
- .wrappers.map(x => x.text().trim());
+ .wrappers.map((x) => x.text().trim());
- expect(changedFileNames).toEqual(allFiles.map(x => x.path));
+ expect(changedFileNames).toEqual(allFiles.map((x) => x.path));
});
it('does not show empty state', () => {
@@ -151,7 +141,7 @@ describe('RepoCommitSection', () => {
beforeEach(() => {
setupDefaultState();
- store.state.changedFiles = store.state.stagedFiles.map(x =>
+ store.state.changedFiles = store.state.stagedFiles.map((x) =>
Object.assign(x, { staged: false }),
);
store.state.stagedFiles = [];
diff --git a/spec/frontend/ide/components/repo_editor_spec.js b/spec/frontend/ide/components/repo_editor_spec.js
index 71a4f08cfb4..89a7f423e34 100644
--- a/spec/frontend/ide/components/repo_editor_spec.js
+++ b/spec/frontend/ide/components/repo_editor_spec.js
@@ -5,6 +5,7 @@ import '~/behaviors/markdown/render_gfm';
import { Range } from 'monaco-editor';
import waitForPromises from 'helpers/wait_for_promises';
import waitUsingRealTimer from 'helpers/wait_using_real_timer';
+import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
import axios from '~/lib/utils/axios_utils';
import service from '~/ide/services';
import { createStoreOptions } from '~/ide/stores';
@@ -16,7 +17,6 @@ import {
FILE_VIEW_MODE_PREVIEW,
viewerTypes,
} from '~/ide/constants';
-import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
import { file } from '../helpers';
import { exampleConfigs, exampleFiles } from '../lib/editorconfig/mock_data';
@@ -25,7 +25,7 @@ describe('RepoEditor', () => {
let store;
const waitForEditorSetup = () =>
- new Promise(resolve => {
+ new Promise((resolve) => {
vm.$once('editorSetup', resolve);
});
@@ -43,7 +43,7 @@ describe('RepoEditor', () => {
vm.$mount();
};
- const createOpenFile = path => {
+ const createOpenFile = (path) => {
const origFile = store.state.openFiles[0];
const newFile = { ...origFile, path, key: path, name: 'myfile.txt', content: 'hello world' };
@@ -91,7 +91,7 @@ describe('RepoEditor', () => {
});
const findEditor = () => vm.$el.querySelector('.multi-file-editor-holder');
- const changeViewMode = viewMode =>
+ const changeViewMode = (viewMode) =>
store.dispatch('editor/updateFileEditor', { path: vm.file.path, data: { viewMode } });
describe('default', () => {
@@ -119,7 +119,7 @@ describe('RepoEditor', () => {
expect(findEditor()).not.toHaveCss({ display: 'none' });
});
- it('renders only an edit tab', done => {
+ it('renders only an edit tab', (done) => {
Vue.nextTick(() => {
const tabs = vm.$el.querySelectorAll('.ide-mode-tabs .nav-links li');
@@ -157,7 +157,7 @@ describe('RepoEditor', () => {
mock.restore();
});
- it('renders an Edit and a Preview Tab', done => {
+ it('renders an Edit and a Preview Tab', (done) => {
Vue.nextTick(() => {
const tabs = vm.$el.querySelectorAll('.ide-mode-tabs .nav-links li');
@@ -169,7 +169,7 @@ describe('RepoEditor', () => {
});
});
- it('renders markdown for tempFile', done => {
+ it('renders markdown for tempFile', (done) => {
vm.file.tempFile = true;
vm.$nextTick()
@@ -202,9 +202,11 @@ describe('RepoEditor', () => {
});
describe('when open file is binary and not raw', () => {
- beforeEach(done => {
+ beforeEach((done) => {
vm.file.name = 'file.dat';
vm.file.content = '🐱'; // non-ascii binary content
+ jest.spyOn(vm.editor, 'createInstance').mockImplementation();
+ jest.spyOn(vm.editor, 'createDiffInstance').mockImplementation();
vm.$nextTick(done);
});
@@ -212,10 +214,20 @@ describe('RepoEditor', () => {
it('does not render the IDE', () => {
expect(vm.shouldHideEditor).toBeTruthy();
});
+
+ it('does not call createInstance', async () => {
+ // Mirror the act's in the `createEditorInstance`
+ vm.createEditorInstance();
+
+ await vm.$nextTick();
+
+ expect(vm.editor.createInstance).not.toHaveBeenCalled();
+ expect(vm.editor.createDiffInstance).not.toHaveBeenCalled();
+ });
});
describe('createEditorInstance', () => {
- it('calls createInstance when viewer is editor', done => {
+ it('calls createInstance when viewer is editor', (done) => {
jest.spyOn(vm.editor, 'createInstance').mockImplementation();
vm.createEditorInstance();
@@ -227,7 +239,7 @@ describe('RepoEditor', () => {
});
});
- it('calls createDiffInstance when viewer is diff', done => {
+ it('calls createDiffInstance when viewer is diff', (done) => {
vm.$store.state.viewer = 'diff';
jest.spyOn(vm.editor, 'createDiffInstance').mockImplementation();
@@ -241,7 +253,7 @@ describe('RepoEditor', () => {
});
});
- it('calls createDiffInstance when viewer is a merge request diff', done => {
+ it('calls createDiffInstance when viewer is a merge request diff', (done) => {
vm.$store.state.viewer = 'mrdiff';
jest.spyOn(vm.editor, 'createDiffInstance').mockImplementation();
@@ -342,7 +354,7 @@ describe('RepoEditor', () => {
jest.spyOn(vm.editor, 'updateDiffView').mockImplementation();
});
- it('calls updateDimensions when panelResizing is false', done => {
+ it('calls updateDimensions when panelResizing is false', (done) => {
vm.$store.state.panelResizing = true;
vm.$nextTick()
@@ -358,7 +370,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
- it('does not call updateDimensions when panelResizing is true', done => {
+ it('does not call updateDimensions when panelResizing is true', (done) => {
vm.$store.state.panelResizing = true;
vm.$nextTick(() => {
@@ -369,7 +381,7 @@ describe('RepoEditor', () => {
});
});
- it('calls updateDimensions when rightPane is opened', done => {
+ it('calls updateDimensions when rightPane is opened', (done) => {
vm.$store.state.rightPane.isOpen = true;
vm.$nextTick(() => {
@@ -386,7 +398,7 @@ describe('RepoEditor', () => {
expect(vm.$el.querySelector('.nav-links')).not.toBe(null);
});
- it('hides tabs in review mode', done => {
+ it('hides tabs in review mode', (done) => {
vm.$store.state.currentActivityView = leftSidebarViews.review.name;
vm.$nextTick(() => {
@@ -396,7 +408,7 @@ describe('RepoEditor', () => {
});
});
- it('hides tabs in commit mode', done => {
+ it('hides tabs in commit mode', (done) => {
vm.$store.state.currentActivityView = leftSidebarViews.commit.name;
vm.$nextTick(() => {
@@ -408,7 +420,7 @@ describe('RepoEditor', () => {
});
describe('when files view mode is preview', () => {
- beforeEach(done => {
+ beforeEach((done) => {
jest.spyOn(vm.editor, 'updateDimensions').mockImplementation();
changeViewMode(FILE_VIEW_MODE_PREVIEW);
vm.file.name = 'myfile.md';
@@ -440,7 +452,7 @@ describe('RepoEditor', () => {
jest.spyOn(vm, 'shouldHideEditor', 'get').mockReturnValue(true);
});
- it('does not fetch file information for temp entries', done => {
+ it('does not fetch file information for temp entries', (done) => {
vm.file.tempFile = true;
vm.initEditor();
@@ -452,7 +464,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
- it('is being initialised for files without content even if shouldHideEditor is `true`', done => {
+ it('is being initialised for files without content even if shouldHideEditor is `true`', (done) => {
vm.file.content = '';
vm.file.raw = '';
@@ -467,7 +479,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
- it('does not initialize editor for files already with content', done => {
+ it('does not initialize editor for files already with content', (done) => {
vm.file.content = 'foo';
vm.initEditor();
@@ -487,7 +499,7 @@ describe('RepoEditor', () => {
jest.spyOn(vm, 'initEditor').mockImplementation();
});
- it('calls removePendingTab when old file is pending', done => {
+ it('calls removePendingTab when old file is pending', (done) => {
jest.spyOn(vm, 'shouldHideEditor', 'get').mockReturnValue(true);
jest.spyOn(vm, 'removePendingTab').mockImplementation();
@@ -507,7 +519,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
- it('does not call initEditor if the file did not change', done => {
+ it('does not call initEditor if the file did not change', (done) => {
Vue.set(vm, 'file', vm.file);
vm.$nextTick()
@@ -518,7 +530,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
- it('calls initEditor when file key is changed', done => {
+ it('calls initEditor when file key is changed', (done) => {
expect(vm.initEditor).not.toHaveBeenCalled();
Vue.set(vm, 'file', {
@@ -540,7 +552,7 @@ describe('RepoEditor', () => {
vm.getRawFileData.mockRestore();
});
- const createRemoteFile = name => ({
+ const createRemoteFile = (name) => ({
...file(name),
tmpFile: false,
});
@@ -593,7 +605,7 @@ describe('RepoEditor', () => {
});
describe('onPaste', () => {
- const setFileName = name => {
+ const setFileName = (name) => {
Vue.set(vm, 'file', {
...vm.file,
content: 'hello world\n',
@@ -615,8 +627,8 @@ describe('RepoEditor', () => {
);
};
- const watchState = watched =>
- new Promise(resolve => {
+ const watchState = (watched) =>
+ new Promise((resolve) => {
const unwatch = vm.$store.watch(watched, () => {
unwatch();
resolve();
@@ -626,7 +638,7 @@ describe('RepoEditor', () => {
// Pasting an image does a lot of things like using the FileReader API,
// so, waitForPromises isn't very reliable (and causes a flaky spec)
// Read more about state.watch: https://vuex.vuejs.org/api/#watch
- const waitForFileContentChange = () => watchState(s => s.entries['foo/bar.md'].content);
+ const waitForFileContentChange = () => watchState((s) => s.entries['foo/bar.md'].content);
beforeEach(() => {
setFileName('bar.md');
diff --git a/spec/frontend/ide/components/repo_tabs_spec.js b/spec/frontend/ide/components/repo_tabs_spec.js
index b251f207853..45a17c37667 100644
--- a/spec/frontend/ide/components/repo_tabs_spec.js
+++ b/spec/frontend/ide/components/repo_tabs_spec.js
@@ -30,7 +30,7 @@ describe('RepoTabs', () => {
wrapper.destroy();
});
- it('renders a list of tabs', done => {
+ it('renders a list of tabs', (done) => {
store.state.openFiles[0].active = true;
wrapper.vm.$nextTick(() => {
diff --git a/spec/frontend/ide/components/resizable_panel_spec.js b/spec/frontend/ide/components/resizable_panel_spec.js
index 7368de0cee7..b1a1212371e 100644
--- a/spec/frontend/ide/components/resizable_panel_spec.js
+++ b/spec/frontend/ide/components/resizable_panel_spec.js
@@ -38,7 +38,7 @@ describe('~/ide/components/resizable_panel', () => {
};
const findResizer = () => wrapper.find(PanelResizer);
const findInlineStyle = () => wrapper.element.style.cssText;
- const createInlineStyle = width => `width: ${width}px;`;
+ const createInlineStyle = (width) => `width: ${width}px;`;
describe.each`
props | showResizer | resizerSide | expectedStyle
diff --git a/spec/frontend/ide/components/shared/tokened_input_spec.js b/spec/frontend/ide/components/shared/tokened_input_spec.js
index e687216bd06..837bfe6b574 100644
--- a/spec/frontend/ide/components/shared/tokened_input_spec.js
+++ b/spec/frontend/ide/components/shared/tokened_input_spec.js
@@ -44,9 +44,9 @@ describe('IDE shared/TokenedInput', () => {
});
it('renders tokens', () => {
- const renderedTokens = getTokenElements(vm).map(x => x.textContent.trim());
+ const renderedTokens = getTokenElements(vm).map((x) => x.textContent.trim());
- expect(renderedTokens).toEqual(TEST_TOKENS.map(x => x.label));
+ expect(renderedTokens).toEqual(TEST_TOKENS.map((x) => x.label));
});
it('renders input', () => {
@@ -54,7 +54,7 @@ describe('IDE shared/TokenedInput', () => {
expect(vm.$refs.input).toHaveValue(TEST_VALUE);
});
- it('renders placeholder, when tokens are empty', done => {
+ it('renders placeholder, when tokens are empty', (done) => {
vm.tokens = [];
vm.$nextTick()
diff --git a/spec/frontend/ide/components/terminal/session_spec.js b/spec/frontend/ide/components/terminal/session_spec.js
index 3ca37166ac4..5653c8bf14d 100644
--- a/spec/frontend/ide/components/terminal/session_spec.js
+++ b/spec/frontend/ide/components/terminal/session_spec.js
@@ -67,7 +67,7 @@ describe('IDE TerminalSession', () => {
});
});
- [STARTING, PENDING, RUNNING].forEach(status => {
+ [STARTING, PENDING, RUNNING].forEach((status) => {
it(`show stop button when status is ${status}`, () => {
state.session = { status };
factory();
@@ -82,7 +82,7 @@ describe('IDE TerminalSession', () => {
});
});
- [STOPPING, STOPPED].forEach(status => {
+ [STOPPING, STOPPED].forEach((status) => {
it(`show stop button when status is ${status}`, () => {
state.session = { status };
factory();
diff --git a/spec/frontend/ide/components/terminal/terminal_controls_spec.js b/spec/frontend/ide/components/terminal/terminal_controls_spec.js
index c22063e1d72..99182710218 100644
--- a/spec/frontend/ide/components/terminal/terminal_controls_spec.js
+++ b/spec/frontend/ide/components/terminal/terminal_controls_spec.js
@@ -17,7 +17,7 @@ describe('IDE TerminalControls', () => {
it('shows an up and down scroll button', () => {
factory();
- expect(buttons.wrappers.map(x => x.props())).toEqual([
+ expect(buttons.wrappers.map((x) => x.props())).toEqual([
expect.objectContaining({ direction: 'up', disabled: true }),
expect.objectContaining({ direction: 'down', disabled: true }),
]);
diff --git a/spec/frontend/ide/components/terminal/terminal_spec.js b/spec/frontend/ide/components/terminal/terminal_spec.js
index 3095288bb28..9cfe167d2f6 100644
--- a/spec/frontend/ide/components/terminal/terminal_spec.js
+++ b/spec/frontend/ide/components/terminal/terminal_spec.js
@@ -1,4 +1,5 @@
-import { createLocalVue, shallowMount } from '@vue/test-utils';
+import Vue, { nextTick } from 'vue';
+import { shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import { GlLoadingIcon } from '@gitlab/ui';
import Terminal from '~/ide/components/terminal/terminal.vue';
@@ -14,24 +15,25 @@ import GLTerminal from '~/terminal/terminal';
const TEST_TERMINAL_PATH = 'terminal/path';
-const localVue = createLocalVue();
-localVue.use(Vuex);
+Vue.use(Vuex);
jest.mock('~/terminal/terminal', () =>
- jest.fn().mockImplementation(() => ({
- dispose: jest.fn(),
- disable: jest.fn(),
- addScrollListener: jest.fn(),
- scrollToTop: jest.fn(),
- scrollToBottom: jest.fn(),
- })),
+ jest.fn().mockImplementation(function FakeTerminal() {
+ Object.assign(this, {
+ dispose: jest.fn(),
+ disable: jest.fn(),
+ addScrollListener: jest.fn(),
+ scrollToTop: jest.fn(),
+ scrollToBottom: jest.fn(),
+ });
+ }),
);
describe('IDE Terminal', () => {
let wrapper;
let state;
- const factory = propsData => {
+ const factory = (propsData) => {
const store = new Vuex.Store({
state,
mutations: {
@@ -41,13 +43,12 @@ describe('IDE Terminal', () => {
},
});
- wrapper = shallowMount(localVue.extend(Terminal), {
+ wrapper = shallowMount(Terminal, {
propsData: {
status: RUNNING,
terminalPath: TEST_TERMINAL_PATH,
...propsData,
},
- localVue,
store,
});
};
@@ -63,7 +64,7 @@ describe('IDE Terminal', () => {
});
describe('loading text', () => {
- [STARTING, PENDING].forEach(status => {
+ [STARTING, PENDING].forEach((status) => {
it(`shows when starting (${status})`, () => {
factory({ status });
@@ -79,7 +80,7 @@ describe('IDE Terminal', () => {
expect(wrapper.find('.top-bar').text()).toBe('Stopping...');
});
- [RUNNING, STOPPED].forEach(status => {
+ [RUNNING, STOPPED].forEach((status) => {
it('hides when not loading', () => {
factory({ status });
@@ -102,7 +103,7 @@ describe('IDE Terminal', () => {
factory();
wrapper.vm.createTerminal();
- return localVue.nextTick();
+ return nextTick();
});
it('is visible if terminal is created', () => {
@@ -129,7 +130,7 @@ describe('IDE Terminal', () => {
wrapper.setData({ canScrollUp: true, canScrollDown: true });
- return localVue.nextTick().then(() => {
+ return nextTick().then(() => {
expect(wrapper.find(TerminalControls).props()).toEqual({
canScrollUp: true,
canScrollDown: true,
@@ -139,30 +140,24 @@ describe('IDE Terminal', () => {
});
describe('refresh', () => {
- let createTerminal;
- let stopTerminal;
-
- beforeEach(() => {
- createTerminal = jest.fn().mockName('createTerminal');
- stopTerminal = jest.fn().mockName('stopTerminal');
- });
-
it('creates the terminal if running', () => {
factory({ status: RUNNING, terminalPath: TEST_TERMINAL_PATH });
- wrapper.setMethods({ createTerminal });
wrapper.vm.refresh();
- expect(createTerminal).toHaveBeenCalled();
+ expect(GLTerminal.mock.instances).toHaveLength(1);
});
- it('stops the terminal if stopping', () => {
- factory({ status: STOPPING });
+ it('stops the terminal if stopping', async () => {
+ factory({ status: RUNNING, terminalPath: TEST_TERMINAL_PATH });
- wrapper.setMethods({ stopTerminal });
wrapper.vm.refresh();
- expect(stopTerminal).toHaveBeenCalled();
+ const terminal = GLTerminal.mock.instances[0];
+ wrapper.setProps({ status: STOPPING });
+ await nextTick();
+
+ expect(terminal.disable).toHaveBeenCalled();
});
});
diff --git a/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js b/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js
index 9adf5848f9d..d15583f81e4 100644
--- a/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js
+++ b/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js
@@ -26,7 +26,7 @@ describe('ide/components/terminal_sync/terminal_sync_status', () => {
namespaced: true,
state: moduleState,
mutations: {
- [START_LOADING]: state => {
+ [START_LOADING]: (state) => {
state.isLoading = true;
},
},
diff --git a/spec/frontend/ide/file_helpers.js b/spec/frontend/ide/file_helpers.js
index 326f8b9716d..19604b9d570 100644
--- a/spec/frontend/ide/file_helpers.js
+++ b/spec/frontend/ide/file_helpers.js
@@ -26,7 +26,7 @@ export const createMovedFile = (path, prevPath, content) =>
prevPath,
});
-export const createEntries = path =>
+export const createEntries = (path) =>
path.split('/').reduce((acc, part, idx, parts) => {
const parentPath = parts.slice(0, idx).join('/');
const fullPath = parentPath ? `${parentPath}/${part}` : part;
diff --git a/spec/frontend/ide/helpers.js b/spec/frontend/ide/helpers.js
index 6b65dd96ef4..f815c3d090e 100644
--- a/spec/frontend/ide/helpers.js
+++ b/spec/frontend/ide/helpers.js
@@ -12,9 +12,9 @@ export const file = (name = 'name', id = name, type = '', parent = null) =>
parentPath: parent ? parent.path : '',
});
-export const createEntriesFromPaths = paths =>
+export const createEntriesFromPaths = (paths) =>
paths
- .map(path => ({
+ .map((path) => ({
name: pathUtils.basename(path),
dir: pathUtils.dirname(path),
ext: pathUtils.extname(path),
@@ -30,7 +30,7 @@ export const createEntriesFromPaths = paths =>
};
}, {});
-export const createTriggerChangeAction = payload => ({
+export const createTriggerChangeAction = (payload) => ({
type: 'triggerFilesChange',
...(payload ? { payload } : {}),
});
@@ -41,5 +41,10 @@ export const createTriggerRenamePayload = (path, newPath) => ({
newPath,
});
+export const createTriggerUpdatePayload = (path) => ({
+ type: commitActionTypes.update,
+ path,
+});
+
export const createTriggerRenameAction = (path, newPath) =>
createTriggerChangeAction(createTriggerRenamePayload(path, newPath));
diff --git a/spec/frontend/ide/ide_router_extension_spec.js b/spec/frontend/ide/ide_router_extension_spec.js
index 3e29ecc4a90..976b127ac83 100644
--- a/spec/frontend/ide/ide_router_extension_spec.js
+++ b/spec/frontend/ide/ide_router_extension_spec.js
@@ -4,7 +4,7 @@ import IdeRouter from '~/ide/ide_router_extension';
jest.mock('vue-router');
describe('IDE overrides of VueRouter', () => {
- const paths = branch => [
+ const paths = (branch) => [
`${branch}`,
`/${branch}`,
`/${branch}/-/`,
@@ -35,7 +35,7 @@ describe('IDE overrides of VueRouter', () => {
${'test-#-hash'} | ${'test-%23-hash'}
${'test/hash#123'} | ${'test/hash%23123'}
`('finds project path when route is $path', ({ path, expected }) => {
- paths(path).forEach(route => {
+ paths(path).forEach((route) => {
const expectedPath = route.replace(path, expected);
router.push(route);
diff --git a/spec/frontend/ide/ide_router_spec.js b/spec/frontend/ide/ide_router_spec.js
index a4fe00883cf..acab2c6aeef 100644
--- a/spec/frontend/ide/ide_router_spec.js
+++ b/spec/frontend/ide/ide_router_spec.js
@@ -32,7 +32,7 @@ describe('IDE router', () => {
`/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/blob`,
`/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/edit`,
`/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}`,
- ].forEach(route => {
+ ].forEach((route) => {
it(`finds project path when route is "${route}"`, () => {
router.push(route);
diff --git a/spec/frontend/ide/lib/common/model_spec.js b/spec/frontend/ide/lib/common/model_spec.js
index df46b7774b0..51df1e2e42f 100644
--- a/spec/frontend/ide/lib/common/model_spec.js
+++ b/spec/frontend/ide/lib/common/model_spec.js
@@ -81,7 +81,7 @@ describe('Multi-file editor library model', () => {
});
describe('onChange', () => {
- it('calls callback on change', done => {
+ it('calls callback on change', (done) => {
const spy = jest.fn();
model.onChange(spy);
diff --git a/spec/frontend/ide/lib/create_diff_spec.js b/spec/frontend/ide/lib/create_diff_spec.js
index 273f9ee27bd..76494f9af1b 100644
--- a/spec/frontend/ide/lib/create_diff_spec.js
+++ b/spec/frontend/ide/lib/create_diff_spec.js
@@ -145,12 +145,12 @@ new file mode 100644
--- /dev/null
+++ b/${PATH_LOREM}
@@ -0,0 +1,${LINES.length} @@
-${LINES.map(line => `+${line}`).join('\n')}
+${LINES.map((line) => `+${line}`).join('\n')}
diff --git "a/${PATH_IPSUM}" "b/${PATH_IPSUM}"
--- a/${PATH_IPSUM}
+++ b/${PATH_IPSUM}
@@ -1,${LINES.length} +1,1 @@
-${LINES.map(line => `-${line}`).join('\n')}
+${LINES.map((line) => `-${line}`).join('\n')}
+That's all folks!
\\ No newline at end of file
`;
@@ -167,10 +167,10 @@ ${LINES.map(line => `-${line}`).join('\n')}
const deletedFiles = ['foo/bar/zed/test.md', 'foo/bar/zed/test2.md'];
const entries = deletedFiles.reduce((acc, path) => Object.assign(acc, createEntries(path)), {});
const allDeleted = [...deletedFiles, 'foo/bar/zed', 'foo/bar'];
- allDeleted.forEach(path => {
+ allDeleted.forEach((path) => {
entries[path].deleted = true;
});
- const changedFiles = deletedFiles.map(x => entries[x]);
+ const changedFiles = deletedFiles.map((x) => entries[x]);
const result = createDiff({ changedFiles, entries });
diff --git a/spec/frontend/ide/lib/create_file_diff_spec.js b/spec/frontend/ide/lib/create_file_diff_spec.js
index 4b428468a6d..294f0a926aa 100644
--- a/spec/frontend/ide/lib/create_file_diff_spec.js
+++ b/spec/frontend/ide/lib/create_file_diff_spec.js
@@ -21,11 +21,7 @@ const spliceLines = (content, lineNumber, deleteCount = 0, newLines = []) => {
return lines.join('\n');
};
-const mapLines = (content, mapFn) =>
- content
- .split('\n')
- .map(mapFn)
- .join('\n');
+const mapLines = (content, mapFn) => content.split('\n').map(mapFn).join('\n');
describe('IDE lib/create_file_diff', () => {
it('returns empty string with "garbage" action', () => {
@@ -55,7 +51,7 @@ describe('IDE lib/create_file_diff', () => {
const expectedHead = `diff --git "a/${PATH}" "b/${PATH}"
new file mode 100644`;
- const expectedChunkHead = lineCount => `--- /dev/null
+ const expectedChunkHead = (lineCount) => `--- /dev/null
+++ b/${PATH}
@@ -0,0 +1,${lineCount} @@`;
@@ -90,7 +86,7 @@ ${expectedChunkHead(1)}
expect(result).toBe(`${expectedHead}
${expectedChunkHead(TEXT_LINE_COUNT)}
-${mapLines(TEXT, line => `+${line}`)}
+${mapLines(TEXT, (line) => `+${line}`)}
`);
});
});
@@ -99,7 +95,7 @@ ${mapLines(TEXT, line => `+${line}`)}
const expectedHead = `diff --git "a/${PATH}" "b/${PATH}"
deleted file mode 100644`;
- const expectedChunkHead = lineCount => `--- a/${PATH}
+ const expectedChunkHead = (lineCount) => `--- a/${PATH}
+++ /dev/null
@@ -1,${lineCount} +0,0 @@`;
@@ -115,7 +111,7 @@ deleted file mode 100644`;
expect(result).toBe(`${expectedHead}
${expectedChunkHead(TEXT_LINE_COUNT)}
-${mapLines(TEXT, line => `-${line}`)}
+${mapLines(TEXT, (line) => `-${line}`)}
`);
});
});
diff --git a/spec/frontend/ide/lib/diff/controller_spec.js b/spec/frontend/ide/lib/diff/controller_spec.js
index 8ee6388a760..57c134620c0 100644
--- a/spec/frontend/ide/lib/diff/controller_spec.js
+++ b/spec/frontend/ide/lib/diff/controller_spec.js
@@ -37,7 +37,7 @@ describe('Multi-file editor library dirty diff controller', () => {
});
describe('getDiffChangeType', () => {
- ['added', 'removed', 'modified'].forEach(type => {
+ ['added', 'removed', 'modified'].forEach((type) => {
it(`returns ${type}`, () => {
const change = {
[type]: true,
@@ -49,7 +49,7 @@ describe('Multi-file editor library dirty diff controller', () => {
});
describe('getDecorator', () => {
- ['added', 'removed', 'modified'].forEach(type => {
+ ['added', 'removed', 'modified'].forEach((type) => {
it(`returns with linesDecorationsClassName for ${type}`, () => {
const change = {
[type]: true,
diff --git a/spec/frontend/ide/lib/editor_spec.js b/spec/frontend/ide/lib/editor_spec.js
index 01c2eab33a5..12779c61dc3 100644
--- a/spec/frontend/ide/lib/editor_spec.js
+++ b/spec/frontend/ide/lib/editor_spec.js
@@ -15,7 +15,7 @@ describe('Multi-file editor library', () => {
let holder;
let store;
- const setNodeOffsetWidth = val => {
+ const setNodeOffsetWidth = (val) => {
Object.defineProperty(instance.instance.getDomNode(), 'offsetWidth', {
get() {
return val;
diff --git a/spec/frontend/ide/lib/editorconfig/parser_spec.js b/spec/frontend/ide/lib/editorconfig/parser_spec.js
index f99410236e1..c2b4a8e6c49 100644
--- a/spec/frontend/ide/lib/editorconfig/parser_spec.js
+++ b/spec/frontend/ide/lib/editorconfig/parser_spec.js
@@ -2,14 +2,14 @@ import { getRulesWithTraversal } from '~/ide/lib/editorconfig/parser';
import { exampleConfigs, exampleFiles } from './mock_data';
describe('~/ide/lib/editorconfig/parser', () => {
- const getExampleConfigContent = path =>
- Promise.resolve(exampleConfigs.find(x => x.path === path)?.content);
+ const getExampleConfigContent = (path) =>
+ Promise.resolve(exampleConfigs.find((x) => x.path === path)?.content);
describe('getRulesWithTraversal', () => {
it.each(exampleFiles)(
'traverses through all editorconfig files in parent directories (until root=true is hit) and finds rules for this file (case %#)',
({ path, rules }) => {
- return getRulesWithTraversal(path, getExampleConfigContent).then(result => {
+ return getRulesWithTraversal(path, getExampleConfigContent).then((result) => {
expect(result).toEqual(rules);
});
},
diff --git a/spec/frontend/ide/lib/errors_spec.js b/spec/frontend/ide/lib/errors_spec.js
index 733d5a5da3c..2e4acdb8a63 100644
--- a/spec/frontend/ide/lib/errors_spec.js
+++ b/spec/frontend/ide/lib/errors_spec.js
@@ -14,7 +14,7 @@ const CODEOWNERS_MESSAGE =
const CHANGED_MESSAGE = 'Things changed since you started editing';
describe('~/ide/lib/errors', () => {
- const createResponseError = message => ({
+ const createResponseError = (message) => ({
response: {
data: {
message,
diff --git a/spec/frontend/ide/lib/files_spec.js b/spec/frontend/ide/lib/files_spec.js
index 8ca6f01d9a6..50738af0e33 100644
--- a/spec/frontend/ide/lib/files_spec.js
+++ b/spec/frontend/ide/lib/files_spec.js
@@ -1,7 +1,9 @@
import { decorateFiles, splitParent } from '~/ide/lib/files';
import { decorateData } from '~/ide/stores/utils';
-const createEntries = paths => {
+const TEST_BLOB_DATA = { mimeType: 'test/mime' };
+
+const createEntries = (paths) => {
const createEntry = (acc, { path, type, children }) => {
const { name, parent } = splitParent(path);
@@ -13,7 +15,8 @@ const createEntries = paths => {
type,
parentPath: parent,
}),
- tree: children.map(childName => expect.objectContaining({ name: childName })),
+ tree: children.map((childName) => expect.objectContaining({ name: childName })),
+ ...(type === 'blob' ? TEST_BLOB_DATA : {}),
};
return acc;
@@ -43,14 +46,14 @@ describe('IDE lib decorate files', () => {
{ path: 'README.md', type: 'blob', children: [] },
]);
- const { entries, treeList } = decorateFiles({ data });
+ const { entries, treeList } = decorateFiles({ data, blobData: TEST_BLOB_DATA });
// Here we test the keys and then each key/value individually because `expect(entries).toEqual(expectedEntries)`
// was taking a very long time for some reason. Probably due to large objects and nested `expect.objectContaining`.
const entryKeys = Object.keys(entries);
expect(entryKeys).toEqual(Object.keys(expectedEntries));
- entryKeys.forEach(key => {
+ entryKeys.forEach((key) => {
expect(entries[key]).toEqual(expectedEntries[key]);
});
diff --git a/spec/frontend/ide/lib/languages/hcl_spec.js b/spec/frontend/ide/lib/languages/hcl_spec.js
index a39673a3225..c6ebad6a4f4 100644
--- a/spec/frontend/ide/lib/languages/hcl_spec.js
+++ b/spec/frontend/ide/lib/languages/hcl_spec.js
@@ -284,6 +284,42 @@ describe('tokenization for .tf files', () => {
],
],
],
+ [
+ ` foo = <<-EOF
+ bar
+ EOF`,
+ [
+ [
+ { language: 'hcl', offset: 0, type: '' },
+ { language: 'hcl', offset: 2, type: 'variable.hcl' },
+ { language: 'hcl', offset: 5, type: '' },
+ { language: 'hcl', offset: 6, type: 'operator.hcl' },
+ { language: 'hcl', offset: 7, type: '' },
+ { language: 'hcl', offset: 8, type: 'string.heredoc.delimiter.hcl' },
+ ],
+ [{ language: 'hcl', offset: 0, type: 'string.heredoc.hcl' }],
+ [
+ { language: 'hcl', offset: 0, type: 'string.heredoc.hcl' },
+ { language: 'hcl', offset: 2, type: 'string.heredoc.delimiter.hcl' },
+ ],
+ ],
+ ],
+ [
+ `foo = <<-EOF
+bar
+EOF`,
+ [
+ [
+ { language: 'hcl', offset: 0, type: 'variable.hcl' },
+ { language: 'hcl', offset: 3, type: '' },
+ { language: 'hcl', offset: 4, type: 'operator.hcl' },
+ { language: 'hcl', offset: 5, type: '' },
+ { language: 'hcl', offset: 6, type: 'string.heredoc.delimiter.hcl' },
+ ],
+ [{ language: 'hcl', offset: 0, type: 'string.heredoc.hcl' }],
+ [{ language: 'hcl', offset: 0, type: 'string.heredoc.delimiter.hcl' }],
+ ],
+ ],
])('%s', (string, tokens) => {
expect(editor.tokenize(string, 'hcl')).toEqual(tokens);
});
diff --git a/spec/frontend/ide/lib/mirror_spec.js b/spec/frontend/ide/lib/mirror_spec.js
index 21bed5948f3..8f417ea54dc 100644
--- a/spec/frontend/ide/lib/mirror_spec.js
+++ b/spec/frontend/ide/lib/mirror_spec.js
@@ -72,7 +72,7 @@ describe('ide/lib/mirror', () => {
});
const waitForConnection = (delay = SERVICE_DELAY) => {
- const wait = new Promise(resolve => {
+ const wait = new Promise((resolve) => {
setTimeout(resolve, 10);
});
@@ -82,7 +82,7 @@ describe('ide/lib/mirror', () => {
};
const connectPass = () => waitForConnection().then(() => mockWebSocket.onopen());
const connectFail = () => waitForConnection().then(() => mockWebSocket.onerror());
- const sendResponse = msg => {
+ const sendResponse = (msg) => {
mockWebSocket.onmessage(msg);
};
diff --git a/spec/frontend/ide/services/index_spec.js b/spec/frontend/ide/services/index_spec.js
index d2c32a81811..c3d6182bd78 100644
--- a/spec/frontend/ide/services/index_spec.js
+++ b/spec/frontend/ide/services/index_spec.js
@@ -51,7 +51,7 @@ describe('IDE services', () => {
raw: 'raw content',
};
- return services.getRawFileData(file).then(raw => {
+ return services.getRawFileData(file).then((raw) => {
expect(raw).toBe('content');
});
});
@@ -65,7 +65,7 @@ describe('IDE services', () => {
raw: 'raw content',
};
- return services.getRawFileData(file).then(raw => {
+ return services.getRawFileData(file).then((raw) => {
expect(raw).toBe('raw content');
});
});
@@ -77,7 +77,7 @@ describe('IDE services', () => {
raw: 'raw content',
};
- return services.getRawFileData(file).then(raw => {
+ return services.getRawFileData(file).then((raw) => {
expect(raw).toBe('raw content');
});
});
@@ -89,7 +89,7 @@ describe('IDE services', () => {
raw: '',
};
- return services.getRawFileData(file).then(raw => {
+ return services.getRawFileData(file).then((raw) => {
expect(raw).toBe('');
});
});
@@ -116,7 +116,22 @@ describe('IDE services', () => {
});
it('sends a request to file.rawPath', () => {
- return services.getRawFileData(file).then(raw => {
+ return services.getRawFileData(file).then((raw) => {
+ expect(axios.get).toHaveBeenCalledWith(file.rawPath, {
+ transformResponse: [expect.any(Function)],
+ });
+ expect(raw).toEqual('raw content');
+ });
+ });
+
+ it('returns arraybuffer for binary files', () => {
+ file.binary = true;
+
+ return services.getRawFileData(file).then((raw) => {
+ expect(axios.get).toHaveBeenCalledWith(file.rawPath, {
+ transformResponse: [expect.any(Function)],
+ responseType: 'arraybuffer',
+ });
expect(raw).toEqual('raw content');
});
});
@@ -146,7 +161,7 @@ describe('IDE services', () => {
it('gives back file.baseRaw for files with that property present', () => {
file.baseRaw = TEST_FILE_CONTENTS;
- return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => {
+ return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => {
expect(content).toEqual(TEST_FILE_CONTENTS);
});
});
@@ -155,7 +170,7 @@ describe('IDE services', () => {
file.tempFile = true;
file.baseRaw = TEST_FILE_CONTENTS;
- return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => {
+ return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => {
expect(content).toEqual(TEST_FILE_CONTENTS);
});
});
@@ -192,7 +207,7 @@ describe('IDE services', () => {
});
it('fetches file content', () =>
- services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => {
+ services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => {
expect(content).toEqual(TEST_FILE_CONTENTS);
}));
},
@@ -209,7 +224,7 @@ describe('IDE services', () => {
Api.project.mockReturnValue(Promise.resolve({ data: { ...projectData } }));
query.mockReturnValue(Promise.resolve({ data: { project: gqlProjectData } }));
- return services.getProjectData(TEST_NAMESPACE, TEST_PROJECT).then(response => {
+ return services.getProjectData(TEST_NAMESPACE, TEST_PROJECT).then((response) => {
expect(response).toEqual({ data: { ...projectData, ...gqlProjectData } });
expect(Api.project).toHaveBeenCalledWith(TEST_PROJECT_ID);
expect(query).toHaveBeenCalledWith({
diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js
index 744ac086b5f..9d367714bbe 100644
--- a/spec/frontend/ide/stores/actions/file_spec.js
+++ b/spec/frontend/ide/stores/actions/file_spec.js
@@ -7,7 +7,7 @@ import * as types from '~/ide/stores/mutation_types';
import service from '~/ide/services';
import { createRouter } from '~/ide/ide_router';
import eventHub from '~/ide/eventhub';
-import { file, createTriggerRenameAction } from '../../helpers';
+import { file, createTriggerRenameAction, createTriggerUpdatePayload } from '../../helpers';
const ORIGINAL_CONTENT = 'original content';
const RELATIVE_URL_ROOT = '/gitlab';
@@ -75,7 +75,7 @@ describe('IDE store file actions', () => {
});
});
- it('closes file & opens next available file', () => {
+ it('switches to the next available file before closing the current one ', () => {
const f = file('newOpenFile');
store.state.openFiles.push(f);
@@ -90,10 +90,12 @@ describe('IDE store file actions', () => {
});
it('removes file if it pending', () => {
- store.state.openFiles.push({
- ...localFile,
- pending: true,
- });
+ store.state.openFiles = [
+ {
+ ...localFile,
+ pending: true,
+ },
+ ];
return store.dispatch('closeFile', localFile).then(() => {
expect(store.state.openFiles.length).toBe(0);
@@ -189,7 +191,7 @@ describe('IDE store file actions', () => {
});
describe('call to service', () => {
- const callExpectation = serviceCalled => {
+ const callExpectation = (serviceCalled) => {
store.dispatch('getFileData', { path: localFile.path });
if (serviceCalled) {
@@ -422,11 +424,11 @@ describe('IDE store file actions', () => {
loadingWhenGettingRawData = undefined;
loadingWhenGettingBaseRawData = undefined;
- jest.spyOn(service, 'getRawFileData').mockImplementation(f => {
+ jest.spyOn(service, 'getRawFileData').mockImplementation((f) => {
loadingWhenGettingRawData = f.loading;
return Promise.resolve('raw');
});
- jest.spyOn(service, 'getBaseRawFileData').mockImplementation(f => {
+ jest.spyOn(service, 'getBaseRawFileData').mockImplementation((f) => {
loadingWhenGettingBaseRawData = f.loading;
return Promise.resolve('rawBase');
});
@@ -510,12 +512,15 @@ describe('IDE store file actions', () => {
describe('changeFileContent', () => {
let tmpFile;
+ let onFilesChange;
beforeEach(() => {
tmpFile = file('tmpFile');
tmpFile.content = '\n';
tmpFile.raw = '\n';
store.state.entries[tmpFile.path] = tmpFile;
+ onFilesChange = jest.fn();
+ eventHub.$on('ide.files.change', onFilesChange);
});
it('updates file content', () => {
@@ -580,6 +585,17 @@ describe('IDE store file actions', () => {
expect(store.state.changedFiles.length).toBe(0);
});
});
+
+ it('triggers ide.files.change', async () => {
+ expect(onFilesChange).not.toHaveBeenCalled();
+
+ await store.dispatch('changeFileContent', {
+ path: tmpFile.path,
+ content: 'content\n',
+ });
+
+ expect(onFilesChange).toHaveBeenCalledWith(createTriggerUpdatePayload(tmpFile.path));
+ });
});
describe('with changed file', () => {
@@ -743,7 +759,7 @@ describe('IDE store file actions', () => {
});
it('returns true when opened', () => {
- return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then(added => {
+ return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then((added) => {
expect(added).toBe(true);
});
});
@@ -755,7 +771,7 @@ describe('IDE store file actions', () => {
key: `pending-${f.key}`,
});
- return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then(added => {
+ return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then((added) => {
expect(added).toBe(false);
});
});
diff --git a/spec/frontend/ide/stores/actions/merge_request_spec.js b/spec/frontend/ide/stores/actions/merge_request_spec.js
index b1cceda9d85..9b17d95ea35 100644
--- a/spec/frontend/ide/stores/actions/merge_request_spec.js
+++ b/spec/frontend/ide/stores/actions/merge_request_spec.js
@@ -49,7 +49,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).reply(200, mockData);
});
- it('calls getProjectMergeRequests service method', done => {
+ it('calls getProjectMergeRequests service method', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.then(() => {
@@ -66,19 +66,19 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
- it('sets the "Merge Request" Object', done => {
+ it('sets the "Merge Request" Object', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.then(() => {
expect(store.state.projects.abcproject.mergeRequests).toEqual({
- '2': expect.objectContaining(mrData),
+ 2: expect.objectContaining(mrData),
});
done();
})
.catch(done.fail);
});
- it('sets "Current Merge Request" object to the most recent MR', done => {
+ it('sets "Current Merge Request" object to the most recent MR', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.then(() => {
@@ -88,7 +88,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
- it('does nothing if user cannot read MRs', done => {
+ it('does nothing if user cannot read MRs', (done) => {
store.state.projects[TEST_PROJECT].userPermissions[PERMISSION_READ_MR] = false;
store
@@ -108,7 +108,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).reply(200, []);
});
- it('does not fail if there are no merge requests for current branch', done => {
+ it('does not fail if there are no merge requests for current branch', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'foo' })
.then(() => {
@@ -126,7 +126,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).networkError();
});
- it('flashes message, if error', done => {
+ it('flashes message, if error', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.catch(() => {
@@ -149,7 +149,7 @@ describe('IDE store merge request actions', () => {
.reply(200, { title: 'mergerequest' });
});
- it('calls getProjectMergeRequestData service method', done => {
+ it('calls getProjectMergeRequestData service method', (done) => {
store
.dispatch('getMergeRequestData', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
@@ -160,7 +160,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
- it('sets the Merge Request Object', done => {
+ it('sets the Merge Request Object', (done) => {
store
.dispatch('getMergeRequestData', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
@@ -180,7 +180,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1/).networkError();
});
- it('dispatches error action', done => {
+ it('dispatches error action', (done) => {
const dispatch = jest.fn();
getMergeRequestData(
@@ -224,7 +224,7 @@ describe('IDE store merge request actions', () => {
.reply(200, { title: 'mergerequest' });
});
- it('calls getProjectMergeRequestChanges service method', done => {
+ it('calls getProjectMergeRequestChanges service method', (done) => {
store
.dispatch('getMergeRequestChanges', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
@@ -235,7 +235,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
- it('sets the Merge Request Changes Object', done => {
+ it('sets the Merge Request Changes Object', (done) => {
store
.dispatch('getMergeRequestChanges', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
@@ -253,7 +253,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1\/changes/).networkError();
});
- it('dispatches error action', done => {
+ it('dispatches error action', (done) => {
const dispatch = jest.fn();
getMergeRequestChanges(
@@ -296,7 +296,7 @@ describe('IDE store merge request actions', () => {
jest.spyOn(service, 'getProjectMergeRequestVersions');
});
- it('calls getProjectMergeRequestVersions service method', done => {
+ it('calls getProjectMergeRequestVersions service method', (done) => {
store
.dispatch('getMergeRequestVersions', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
@@ -307,7 +307,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
- it('sets the Merge Request Versions Object', done => {
+ it('sets the Merge Request Versions Object', (done) => {
store
.dispatch('getMergeRequestVersions', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
@@ -323,7 +323,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1\/versions/).networkError();
});
- it('dispatches error action', done => {
+ it('dispatches error action', (done) => {
const dispatch = jest.fn();
getMergeRequestVersions(
@@ -422,7 +422,7 @@ describe('IDE store merge request actions', () => {
);
});
- it('dispatches actions for merge request data', done => {
+ it('dispatches actions for merge request data', (done) => {
openMergeRequest({ state: store.state, dispatch: store.dispatch, getters: mockGetters }, mr)
.then(() => {
expect(store.dispatch.mock.calls).toEqual([
@@ -451,7 +451,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
- it('updates activity bar view and gets file data, if changes are found', done => {
+ it('updates activity bar view and gets file data, if changes are found', (done) => {
store.state.entries.foo = {
type: 'blob',
};
@@ -490,7 +490,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
- it('flashes message, if error', done => {
+ it('flashes message, if error', (done) => {
store.dispatch.mockRejectedValue();
openMergeRequest(store, mr)
diff --git a/spec/frontend/ide/stores/actions/project_spec.js b/spec/frontend/ide/stores/actions/project_spec.js
index ca3687307a9..1244c8af91a 100644
--- a/spec/frontend/ide/stores/actions/project_spec.js
+++ b/spec/frontend/ide/stores/actions/project_spec.js
@@ -53,7 +53,7 @@ describe('IDE store project actions', () => {
});
});
- it('calls the service', done => {
+ it('calls the service', (done) => {
store
.dispatch('refreshLastCommitData', {
projectId: store.state.currentProjectId,
@@ -67,7 +67,7 @@ describe('IDE store project actions', () => {
.catch(done.fail);
});
- it('commits getBranchData', done => {
+ it('commits getBranchData', (done) => {
testAction(
refreshLastCommitData,
{
@@ -94,7 +94,7 @@ describe('IDE store project actions', () => {
});
describe('showBranchNotFoundError', () => {
- it('dispatches setErrorMessage', done => {
+ it('dispatches setErrorMessage', (done) => {
testAction(
showBranchNotFoundError,
'master',
@@ -123,7 +123,7 @@ describe('IDE store project actions', () => {
jest.spyOn(api, 'createBranch').mockResolvedValue();
});
- it('calls API', done => {
+ it('calls API', (done) => {
createNewBranchFromDefault(
{
state: {
@@ -148,7 +148,7 @@ describe('IDE store project actions', () => {
.catch(done.fail);
});
- it('clears error message', done => {
+ it('clears error message', (done) => {
const dispatchSpy = jest.fn().mockName('dispatch');
createNewBranchFromDefault(
@@ -172,7 +172,7 @@ describe('IDE store project actions', () => {
.catch(done.fail);
});
- it('reloads window', done => {
+ it('reloads window', (done) => {
createNewBranchFromDefault(
{
state: {
@@ -196,7 +196,7 @@ describe('IDE store project actions', () => {
});
describe('loadEmptyBranch', () => {
- it('creates a blank tree and sets loading state to false', done => {
+ it('creates a blank tree and sets loading state to false', (done) => {
testAction(
loadEmptyBranch,
{ projectId: TEST_PROJECT_ID, branchId: 'master' },
@@ -213,7 +213,7 @@ describe('IDE store project actions', () => {
);
});
- it('does nothing, if tree already exists', done => {
+ it('does nothing, if tree already exists', (done) => {
const trees = { [`${TEST_PROJECT_ID}/master`]: [] };
testAction(
@@ -279,7 +279,7 @@ describe('IDE store project actions', () => {
const branchId = '123-lorem';
const ref = 'abcd2322';
- it('when empty repo, loads empty branch', done => {
+ it('when empty repo, loads empty branch', (done) => {
const mockGetters = { emptyRepo: true };
testAction(
@@ -292,13 +292,13 @@ describe('IDE store project actions', () => {
);
});
- it('when branch already exists, does nothing', done => {
+ it('when branch already exists, does nothing', (done) => {
store.state.projects[projectId].branches[branchId] = {};
testAction(loadBranch, { projectId, branchId }, store.state, [], [], done);
});
- it('fetches branch data', done => {
+ it('fetches branch data', (done) => {
const mockGetters = { findBranch: () => ({ commit: { id: ref } }) };
jest.spyOn(store, 'dispatch').mockResolvedValue();
@@ -317,7 +317,7 @@ describe('IDE store project actions', () => {
.catch(done.fail);
});
- it('shows an error if branch can not be fetched', done => {
+ it('shows an error if branch can not be fetched', (done) => {
jest.spyOn(store, 'dispatch').mockReturnValue(Promise.reject());
loadBranch(store, { projectId, branchId })
@@ -356,7 +356,7 @@ describe('IDE store project actions', () => {
jest.spyOn(store, 'dispatch').mockResolvedValue();
});
- it('dispatches branch actions', done => {
+ it('dispatches branch actions', (done) => {
openBranch(store, branch)
.then(() => {
expect(store.dispatch.mock.calls).toEqual([
@@ -375,9 +375,9 @@ describe('IDE store project actions', () => {
jest.spyOn(store, 'dispatch').mockReturnValue(Promise.reject());
});
- it('dispatches correct branch actions', done => {
+ it('dispatches correct branch actions', (done) => {
openBranch(store, branch)
- .then(val => {
+ .then((val) => {
expect(store.dispatch.mock.calls).toEqual([
['setCurrentBranchId', branchId],
['loadBranch', { projectId, branchId }],
diff --git a/spec/frontend/ide/stores/actions/tree_spec.js b/spec/frontend/ide/stores/actions/tree_spec.js
index 0eabd982d57..7831df9f3a4 100644
--- a/spec/frontend/ide/stores/actions/tree_spec.js
+++ b/spec/frontend/ide/stores/actions/tree_spec.js
@@ -1,6 +1,6 @@
import MockAdapter from 'axios-mock-adapter';
import testAction from 'helpers/vuex_action_helper';
-import { TEST_HOST } from 'jest/helpers/test_constants';
+import { TEST_HOST } from 'helpers/test_constants';
import { showTreeEntry, getFiles, setDirectoryData } from '~/ide/stores/actions/tree';
import * as types from '~/ide/stores/mutation_types';
import axios from '~/lib/utils/axios_utils';
@@ -57,26 +57,15 @@ describe('Multi-file store tree actions', () => {
});
it('calls service getFiles', () => {
- return (
- store
- .dispatch('getFiles', basicCallParameters)
- // getFiles actions calls lodash.defer
- .then(() => jest.runOnlyPendingTimers())
- .then(() => {
- expect(service.getFiles).toHaveBeenCalledWith('foo/abcproject', '12345678');
- })
- );
+ return store.dispatch('getFiles', basicCallParameters).then(() => {
+ expect(service.getFiles).toHaveBeenCalledWith('foo/abcproject', '12345678');
+ });
});
- it('adds data into tree', done => {
+ it('adds data into tree', (done) => {
store
.dispatch('getFiles', basicCallParameters)
.then(() => {
- // The populating of the tree is deferred for performance reasons.
- // See this merge request for details: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/25700
- jest.advanceTimersByTime(1);
- })
- .then(() => {
projectTree = store.state.trees['abcproject/master'];
expect(projectTree.tree.length).toBe(2);
@@ -93,7 +82,7 @@ describe('Multi-file store tree actions', () => {
});
describe('error', () => {
- it('dispatches error action', done => {
+ it('dispatches error action', (done) => {
const dispatch = jest.fn();
store.state.projects = {
@@ -148,7 +137,7 @@ describe('Multi-file store tree actions', () => {
store.state.entries[tree.path] = tree;
});
- it('toggles the tree open', done => {
+ it('toggles the tree open', (done) => {
store
.dispatch('toggleTreeOpen', tree.path)
.then(() => {
@@ -174,7 +163,7 @@ describe('Multi-file store tree actions', () => {
Object.assign(store.state.entries, createEntriesFromPaths(paths));
});
- it('opens the parents', done => {
+ it('opens the parents', (done) => {
testAction(
showTreeEntry,
'grandparent/parent/child.txt',
@@ -187,7 +176,7 @@ describe('Multi-file store tree actions', () => {
});
describe('setDirectoryData', () => {
- it('sets tree correctly if there are no opened files yet', done => {
+ it('sets tree correctly if there are no opened files yet', (done) => {
const treeFile = file({ name: 'README.md' });
store.state.trees['abcproject/master'] = {};
diff --git a/spec/frontend/ide/stores/actions_spec.js b/spec/frontend/ide/stores/actions_spec.js
index 04128c27e70..036bc91cd11 100644
--- a/spec/frontend/ide/stores/actions_spec.js
+++ b/spec/frontend/ide/stores/actions_spec.js
@@ -1,4 +1,5 @@
import MockAdapter from 'axios-mock-adapter';
+import testAction from 'helpers/vuex_action_helper';
import { visitUrl } from '~/lib/utils/url_utility';
import { createStore } from '~/ide/stores';
import { createRouter } from '~/ide/ide_router';
@@ -20,7 +21,6 @@ import {
import axios from '~/lib/utils/axios_utils';
import * as types from '~/ide/stores/mutation_types';
import { file, createTriggerRenameAction, createTriggerChangeAction } from '../helpers';
-import testAction from '../../helpers/vuex_action_helper';
import eventHub from '~/ide/eventhub';
jest.mock('~/lib/utils/url_utility', () => ({
@@ -42,7 +42,7 @@ describe('Multi-file store actions', () => {
});
describe('redirectToUrl', () => {
- it('calls visitUrl', done => {
+ it('calls visitUrl', (done) => {
store
.dispatch('redirectToUrl', 'test')
.then(() => {
@@ -55,7 +55,7 @@ describe('Multi-file store actions', () => {
});
describe('setInitialData', () => {
- it('commits initial data', done => {
+ it('commits initial data', (done) => {
store
.dispatch('setInitialData', { canCommit: true })
.then(() => {
@@ -70,7 +70,7 @@ describe('Multi-file store actions', () => {
const paths = ['to_discard', 'another_one_to_discard'];
beforeEach(() => {
- paths.forEach(path => {
+ paths.forEach((path) => {
const f = file(path);
f.changed = true;
@@ -81,14 +81,14 @@ describe('Multi-file store actions', () => {
});
it('discards all changes in file', () => {
- const expectedCalls = paths.map(path => ['restoreOriginalFile', path]);
+ const expectedCalls = paths.map((path) => ['restoreOriginalFile', path]);
discardAllChanges(store);
expect(store.dispatch.mock.calls).toEqual(expect.arrayContaining(expectedCalls));
});
- it('removes all files from changedFiles state', done => {
+ it('removes all files from changedFiles state', (done) => {
store
.dispatch('discardAllChanges')
.then(() => {
@@ -120,7 +120,7 @@ describe('Multi-file store actions', () => {
});
describe('tree', () => {
- it('creates temp tree', done => {
+ it('creates temp tree', (done) => {
store
.dispatch('createTempEntry', {
name: 'test',
@@ -137,7 +137,7 @@ describe('Multi-file store actions', () => {
.catch(done.fail);
});
- it('creates new folder inside another tree', done => {
+ it('creates new folder inside another tree', (done) => {
const tree = {
type: 'tree',
name: 'testing',
@@ -162,7 +162,7 @@ describe('Multi-file store actions', () => {
.catch(done.fail);
});
- it('does not create new tree if already exists', done => {
+ it('does not create new tree if already exists', (done) => {
const tree = {
type: 'tree',
path: 'testing',
@@ -188,18 +188,20 @@ describe('Multi-file store actions', () => {
});
describe('blob', () => {
- it('creates temp file', done => {
+ it('creates temp file', (done) => {
const name = 'test';
store
.dispatch('createTempEntry', {
name,
type: 'blob',
+ mimeType: 'test/mime',
})
.then(() => {
const f = store.state.entries[name];
expect(f.tempFile).toBeTruthy();
+ expect(f.mimeType).toBe('test/mime');
expect(store.state.trees['abcproject/mybranch'].tree.length).toBe(1);
done();
@@ -207,7 +209,7 @@ describe('Multi-file store actions', () => {
.catch(done.fail);
});
- it('adds tmp file to open files', done => {
+ it('adds tmp file to open files', (done) => {
const name = 'test';
store
@@ -226,7 +228,7 @@ describe('Multi-file store actions', () => {
.catch(done.fail);
});
- it('adds tmp file to staged files', done => {
+ it('adds tmp file to staged files', (done) => {
const name = 'test';
store
@@ -248,7 +250,7 @@ describe('Multi-file store actions', () => {
expect(store.dispatch).toHaveBeenCalledWith('setFileActive', 'test');
});
- it('creates flash message if file already exists', done => {
+ it('creates flash message if file already exists', (done) => {
const f = file('test', '1', 'blob');
store.state.trees['abcproject/mybranch'].tree = [f];
store.state.entries[f.path] = f;
@@ -271,7 +273,7 @@ describe('Multi-file store actions', () => {
});
describe('scrollToTab', () => {
- it('focuses the current active element', done => {
+ it('focuses the current active element', (done) => {
document.body.innerHTML +=
'<div id="tabs"><div class="active"><div class="repo-tab"></div></div></div>';
const el = document.querySelector('.repo-tab');
@@ -376,7 +378,7 @@ describe('Multi-file store actions', () => {
});
describe('updateViewer', () => {
- it('updates viewer state', done => {
+ it('updates viewer state', (done) => {
store
.dispatch('updateViewer', 'diff')
.then(() => {
@@ -388,7 +390,7 @@ describe('Multi-file store actions', () => {
});
describe('updateActivityBarView', () => {
- it('commits UPDATE_ACTIVITY_BAR_VIEW', done => {
+ it('commits UPDATE_ACTIVITY_BAR_VIEW', (done) => {
testAction(
updateActivityBarView,
'test',
@@ -401,7 +403,7 @@ describe('Multi-file store actions', () => {
});
describe('setEmptyStateSvgs', () => {
- it('commits setEmptyStateSvgs', done => {
+ it('commits setEmptyStateSvgs', (done) => {
testAction(
setEmptyStateSvgs,
'svg',
@@ -414,7 +416,7 @@ describe('Multi-file store actions', () => {
});
describe('updateTempFlagForEntry', () => {
- it('commits UPDATE_TEMP_FLAG', done => {
+ it('commits UPDATE_TEMP_FLAG', (done) => {
const f = {
...file(),
path: 'test',
@@ -432,7 +434,7 @@ describe('Multi-file store actions', () => {
);
});
- it('commits UPDATE_TEMP_FLAG and dispatches for parent', done => {
+ it('commits UPDATE_TEMP_FLAG and dispatches for parent', (done) => {
const parent = {
...file(),
path: 'testing',
@@ -455,7 +457,7 @@ describe('Multi-file store actions', () => {
);
});
- it('does not dispatch for parent, if parent does not exist', done => {
+ it('does not dispatch for parent, if parent does not exist', (done) => {
const f = {
...file(),
path: 'test',
@@ -475,7 +477,7 @@ describe('Multi-file store actions', () => {
});
describe('setCurrentBranchId', () => {
- it('commits setCurrentBranchId', done => {
+ it('commits setCurrentBranchId', (done) => {
testAction(
setCurrentBranchId,
'branchId',
@@ -488,7 +490,7 @@ describe('Multi-file store actions', () => {
});
describe('toggleFileFinder', () => {
- it('commits TOGGLE_FILE_FINDER', done => {
+ it('commits TOGGLE_FILE_FINDER', (done) => {
testAction(
toggleFileFinder,
true,
@@ -501,7 +503,7 @@ describe('Multi-file store actions', () => {
});
describe('setErrorMessage', () => {
- it('commis error messsage', done => {
+ it('commis error messsage', (done) => {
testAction(
setErrorMessage,
'error',
@@ -514,7 +516,7 @@ describe('Multi-file store actions', () => {
});
describe('deleteEntry', () => {
- it('commits entry deletion', done => {
+ it('commits entry deletion', (done) => {
store.state.entries.path = 'testing';
testAction(
@@ -527,7 +529,7 @@ describe('Multi-file store actions', () => {
);
});
- it('does not delete a folder after it is emptied', done => {
+ it('does not delete a folder after it is emptied', (done) => {
const testFolder = {
type: 'tree',
tree: [],
@@ -573,7 +575,7 @@ describe('Multi-file store actions', () => {
});
describe('and previous does not exist', () => {
- it('reverts the rename before deleting', done => {
+ it('reverts the rename before deleting', (done) => {
testAction(
deleteEntry,
testEntry.path,
@@ -608,7 +610,7 @@ describe('Multi-file store actions', () => {
store.state.entries[oldEntry.path] = oldEntry;
});
- it('does not revert rename before deleting', done => {
+ it('does not revert rename before deleting', (done) => {
testAction(
deleteEntry,
testEntry.path,
@@ -619,7 +621,7 @@ describe('Multi-file store actions', () => {
);
});
- it('when previous is deleted, it reverts rename before deleting', done => {
+ it('when previous is deleted, it reverts rename before deleting', (done) => {
store.state.entries[testEntry.prevPath].deleted = true;
testAction(
@@ -654,7 +656,7 @@ describe('Multi-file store actions', () => {
jest.spyOn(eventHub, '$emit').mockImplementation();
});
- it('does not purge model cache for temporary entries that got renamed', done => {
+ it('does not purge model cache for temporary entries that got renamed', (done) => {
Object.assign(store.state.entries, {
test: {
...file('test'),
@@ -676,7 +678,7 @@ describe('Multi-file store actions', () => {
.catch(done.fail);
});
- it('purges model cache for renamed entry', done => {
+ it('purges model cache for renamed entry', (done) => {
Object.assign(store.state.entries, {
test: {
...file('test'),
@@ -735,7 +737,7 @@ describe('Multi-file store actions', () => {
]);
});
- it('if not changed, completely unstages and discards entry if renamed to original', done => {
+ it('if not changed, completely unstages and discards entry if renamed to original', (done) => {
testAction(
renameEntry,
{ path: 'renamed', name: 'orig' },
@@ -759,7 +761,7 @@ describe('Multi-file store actions', () => {
);
});
- it('if already in changed, does not add to change', done => {
+ it('if already in changed, does not add to change', (done) => {
store.state.changedFiles.push(renamedEntry);
testAction(
@@ -772,7 +774,7 @@ describe('Multi-file store actions', () => {
);
});
- it('routes to the renamed file if the original file has been opened', done => {
+ it('routes to the renamed file if the original file has been opened', (done) => {
store.state.currentProjectId = 'test/test';
store.state.currentBranchId = 'master';
@@ -813,7 +815,7 @@ describe('Multi-file store actions', () => {
});
});
- it('updates entries in a folder correctly, when folder is renamed', done => {
+ it('updates entries in a folder correctly, when folder is renamed', (done) => {
store
.dispatch('renameEntry', {
path: 'folder',
@@ -831,7 +833,7 @@ describe('Multi-file store actions', () => {
.catch(done.fail);
});
- it('discards renaming of an entry if the root folder is renamed back to a previous name', done => {
+ it('discards renaming of an entry if the root folder is renamed back to a previous name', (done) => {
const rootFolder = file('old-folder', 'old-folder', 'tree');
const testEntry = file('test', 'test', 'blob', rootFolder);
@@ -923,7 +925,7 @@ describe('Multi-file store actions', () => {
});
});
- it('creates new directory', done => {
+ it('creates new directory', (done) => {
expect(store.state.entries[newParentPath]).toBeUndefined();
store
@@ -953,7 +955,7 @@ describe('Multi-file store actions', () => {
rootDir.tree.push(newDir);
});
- it('inserts in new directory', done => {
+ it('inserts in new directory', (done) => {
expect(newDir.tree).toEqual([]);
store
@@ -969,11 +971,11 @@ describe('Multi-file store actions', () => {
.catch(done.fail);
});
- it('when new directory is deleted, it undeletes it', done => {
+ it('when new directory is deleted, it undeletes it', (done) => {
store.dispatch('deleteEntry', newParentPath);
expect(store.state.entries[newParentPath].deleted).toBe(true);
- expect(rootDir.tree.some(x => x.path === newParentPath)).toBe(false);
+ expect(rootDir.tree.some((x) => x.path === newParentPath)).toBe(false);
store
.dispatch('renameEntry', {
@@ -983,7 +985,7 @@ describe('Multi-file store actions', () => {
})
.then(() => {
expect(store.state.entries[newParentPath].deleted).toBe(false);
- expect(rootDir.tree.some(x => x.path === newParentPath)).toBe(true);
+ expect(rootDir.tree.some((x) => x.path === newParentPath)).toBe(true);
})
.then(done)
.catch(done.fail);
@@ -1027,12 +1029,12 @@ describe('Multi-file store actions', () => {
document.querySelector('.flash-container').remove();
});
- it('passes the error further unchanged without dispatching any action when response is 404', done => {
+ it('passes the error further unchanged without dispatching any action when response is 404', (done) => {
mock.onGet(/(.*)/).replyOnce(404);
getBranchData(...callParams)
.then(done.fail)
- .catch(e => {
+ .catch((e) => {
expect(dispatch.mock.calls).toHaveLength(0);
expect(e.response.status).toEqual(404);
expect(document.querySelector('.flash-alert')).toBeNull();
@@ -1040,12 +1042,12 @@ describe('Multi-file store actions', () => {
});
});
- it('does not pass the error further and flashes an alert if error is not 404', done => {
+ it('does not pass the error further and flashes an alert if error is not 404', (done) => {
mock.onGet(/(.*)/).replyOnce(418);
getBranchData(...callParams)
.then(done.fail)
- .catch(e => {
+ .catch((e) => {
expect(dispatch.mock.calls).toHaveLength(0);
expect(e.response).toBeUndefined();
expect(document.querySelector('.flash-alert')).not.toBeNull();
diff --git a/spec/frontend/ide/stores/extend_spec.js b/spec/frontend/ide/stores/extend_spec.js
index b0f1063153e..ffb00f9ef5b 100644
--- a/spec/frontend/ide/stores/extend_spec.js
+++ b/spec/frontend/ide/stores/extend_spec.js
@@ -15,7 +15,7 @@ describe('ide/stores/extend', () => {
store = {};
el = {};
- [terminalPlugin, terminalSyncPlugin].forEach(x => {
+ [terminalPlugin, terminalSyncPlugin].forEach((x) => {
const plugin = jest.fn();
x.mockImplementation(() => plugin);
@@ -28,7 +28,7 @@ describe('ide/stores/extend', () => {
terminalSyncPlugin.mockClear();
});
- const withGonFeatures = features => {
+ const withGonFeatures = (features) => {
global.gon = { ...global.gon, features };
};
diff --git a/spec/frontend/ide/stores/getters_spec.js b/spec/frontend/ide/stores/getters_spec.js
index 5ae87f5f9cd..1787f9e9361 100644
--- a/spec/frontend/ide/stores/getters_spec.js
+++ b/spec/frontend/ide/stores/getters_spec.js
@@ -407,7 +407,7 @@ describe('IDE store getters', () => {
${'canCreateMergeRequests'} | ${'createMergeRequestIn'}
${'canPushCode'} | ${'pushCode'}
`('$getterName', ({ getterName, permissionKey }) => {
- it.each([true, false])('finds permission for current project (%s)', val => {
+ it.each([true, false])('finds permission for current project (%s)', (val) => {
localState.projects[TEST_PROJECT_ID] = {
userPermissions: {
[permissionKey]: val,
diff --git a/spec/frontend/ide/stores/integration_spec.js b/spec/frontend/ide/stores/integration_spec.js
index b6a7c7fd02d..388bd3b99d2 100644
--- a/spec/frontend/ide/stores/integration_spec.js
+++ b/spec/frontend/ide/stores/integration_spec.js
@@ -84,7 +84,7 @@ describe('IDE store integration', () => {
store.dispatch('commit/updateFilesAfterCommit', { data: {} });
expect(store.state.entries[TEST_PATH]).toEqual(expected);
- expect(store.state.entries[TEST_PATH_DIR].tree.find(x => x.path === TEST_PATH)).toEqual(
+ expect(store.state.entries[TEST_PATH_DIR].tree.find((x) => x.path === TEST_PATH)).toEqual(
expected,
);
});
diff --git a/spec/frontend/ide/stores/modules/branches/actions_spec.js b/spec/frontend/ide/stores/modules/branches/actions_spec.js
index 2ab4126cccf..b1c077c4082 100644
--- a/spec/frontend/ide/stores/modules/branches/actions_spec.js
+++ b/spec/frontend/ide/stores/modules/branches/actions_spec.js
@@ -42,7 +42,7 @@ describe('IDE branches actions', () => {
});
describe('requestBranches', () => {
- it('should commit request', done => {
+ it('should commit request', (done) => {
testAction(
requestBranches,
null,
@@ -55,7 +55,7 @@ describe('IDE branches actions', () => {
});
describe('receiveBranchesError', () => {
- it('should commit error', done => {
+ it('should commit error', (done) => {
testAction(
receiveBranchesError,
{ search: TEST_SEARCH },
@@ -78,7 +78,7 @@ describe('IDE branches actions', () => {
});
describe('receiveBranchesSuccess', () => {
- it('should commit received data', done => {
+ it('should commit received data', (done) => {
testAction(
receiveBranchesSuccess,
branches,
@@ -110,7 +110,7 @@ describe('IDE branches actions', () => {
});
});
- it('dispatches success with received data', done => {
+ it('dispatches success with received data', (done) => {
testAction(
fetchBranches,
{ search: TEST_SEARCH },
@@ -131,7 +131,7 @@ describe('IDE branches actions', () => {
mock.onGet(/\/api\/v4\/projects\/\d+\/repository\/branches(.*)$/).replyOnce(500);
});
- it('dispatches error', done => {
+ it('dispatches error', (done) => {
testAction(
fetchBranches,
{ search: TEST_SEARCH },
@@ -148,7 +148,7 @@ describe('IDE branches actions', () => {
});
describe('resetBranches', () => {
- it('commits reset', done => {
+ it('commits reset', (done) => {
testAction(
resetBranches,
null,
diff --git a/spec/frontend/ide/stores/modules/branches/mutations_spec.js b/spec/frontend/ide/stores/modules/branches/mutations_spec.js
index ed8e05bf299..ddf55479be9 100644
--- a/spec/frontend/ide/stores/modules/branches/mutations_spec.js
+++ b/spec/frontend/ide/stores/modules/branches/mutations_spec.js
@@ -28,7 +28,7 @@ describe('IDE branches mutations', () => {
describe('RECEIVE_BRANCHES_SUCCESS', () => {
it('sets branches', () => {
- const expectedBranches = branches.map(branch => ({
+ const expectedBranches = branches.map((branch) => ({
name: branch.name,
committedDate: branch.commit.committed_date,
}));
diff --git a/spec/frontend/ide/stores/modules/clientside/actions_spec.js b/spec/frontend/ide/stores/modules/clientside/actions_spec.js
index a47bc0bd711..05627f8ed0e 100644
--- a/spec/frontend/ide/stores/modules/clientside/actions_spec.js
+++ b/spec/frontend/ide/stores/modules/clientside/actions_spec.js
@@ -25,7 +25,7 @@ describe('IDE store module clientside actions', () => {
});
describe('pingUsage', () => {
- it('posts to usage endpoint', done => {
+ it('posts to usage endpoint', (done) => {
const usageSpy = jest.fn(() => [200]);
mock.onPost(TEST_USAGE_URL).reply(() => usageSpy());
diff --git a/spec/frontend/ide/stores/modules/commit/actions_spec.js b/spec/frontend/ide/stores/modules/commit/actions_spec.js
index cfe2bddf76c..5be0e22a9fc 100644
--- a/spec/frontend/ide/stores/modules/commit/actions_spec.js
+++ b/spec/frontend/ide/stores/modules/commit/actions_spec.js
@@ -1,6 +1,7 @@
import { file } from 'jest/ide/helpers';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
+import testAction from 'helpers/vuex_action_helper';
import { visitUrl } from '~/lib/utils/url_utility';
import { createStore } from '~/ide/stores';
import service from '~/ide/services';
@@ -11,7 +12,6 @@ import * as mutationTypes from '~/ide/stores/modules/commit/mutation_types';
import * as actions from '~/ide/stores/modules/commit/actions';
import { createUnexpectedCommitError } from '~/ide/lib/errors';
import { commitActionTypes, PERMISSION_CREATE_MR } from '~/ide/constants';
-import testAction from '../../../../helpers/vuex_action_helper';
jest.mock('~/lib/utils/url_utility', () => ({
...jest.requireActual('~/lib/utils/url_utility'),
@@ -19,6 +19,17 @@ jest.mock('~/lib/utils/url_utility', () => ({
}));
const TEST_COMMIT_SHA = '123456789';
+const COMMIT_RESPONSE = {
+ id: '123456',
+ short_id: '123',
+ message: 'test message',
+ committed_date: 'date',
+ parent_ids: [],
+ stats: {
+ additions: '1',
+ deletions: '2',
+ },
+};
describe('IDE commit module actions', () => {
let mock;
@@ -32,7 +43,9 @@ describe('IDE commit module actions', () => {
mock = new MockAdapter(axios);
jest.spyOn(router, 'push').mockImplementation();
- mock.onGet('/api/v1/projects/abcproject/repository/branches/master').reply(200);
+ mock
+ .onGet('/api/v1/projects/abcproject/repository/branches/master')
+ .reply(200, { commit: COMMIT_RESPONSE });
});
afterEach(() => {
@@ -41,7 +54,7 @@ describe('IDE commit module actions', () => {
});
describe('updateCommitMessage', () => {
- it('updates store with new commit message', done => {
+ it('updates store with new commit message', (done) => {
store
.dispatch('commit/updateCommitMessage', 'testing')
.then(() => {
@@ -53,7 +66,7 @@ describe('IDE commit module actions', () => {
});
describe('discardDraft', () => {
- it('resets commit message to blank', done => {
+ it('resets commit message to blank', (done) => {
store.state.commit.commitMessage = 'testing';
store
@@ -67,7 +80,7 @@ describe('IDE commit module actions', () => {
});
describe('updateCommitAction', () => {
- it('updates store with new commit action', done => {
+ it('updates store with new commit action', (done) => {
store
.dispatch('commit/updateCommitAction', '1')
.then(() => {
@@ -123,7 +136,7 @@ describe('IDE commit module actions', () => {
});
});
- it('updates commit message with short_id', done => {
+ it('updates commit message with short_id', (done) => {
store
.dispatch('commit/setLastCommitMessage', { short_id: '123' })
.then(() => {
@@ -135,7 +148,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('updates commit message with stats', done => {
+ it('updates commit message with stats', (done) => {
store
.dispatch('commit/setLastCommitMessage', {
short_id: '123',
@@ -200,12 +213,12 @@ describe('IDE commit module actions', () => {
});
store.state.openFiles = store.state.stagedFiles;
- store.state.stagedFiles.forEach(stagedFile => {
+ store.state.stagedFiles.forEach((stagedFile) => {
store.state.entries[stagedFile.path] = stagedFile;
});
});
- it('updates stores working reference', done => {
+ it('updates stores working reference', (done) => {
store
.dispatch('commit/updateFilesAfterCommit', {
data,
@@ -218,14 +231,14 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('resets all files changed status', done => {
+ it('resets all files changed status', (done) => {
store
.dispatch('commit/updateFilesAfterCommit', {
data,
branch,
})
.then(() => {
- store.state.openFiles.forEach(entry => {
+ store.state.openFiles.forEach((entry) => {
expect(entry.changed).toBeFalsy();
});
})
@@ -233,7 +246,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('sets files commit data', done => {
+ it('sets files commit data', (done) => {
store
.dispatch('commit/updateFilesAfterCommit', {
data,
@@ -246,7 +259,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('updates raw content for changed file', done => {
+ it('updates raw content for changed file', (done) => {
store
.dispatch('commit/updateFilesAfterCommit', {
data,
@@ -259,7 +272,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('emits changed event for file', done => {
+ it('emits changed event for file', (done) => {
store
.dispatch('commit/updateFilesAfterCommit', {
data,
@@ -319,7 +332,7 @@ describe('IDE commit module actions', () => {
store.state.commit.commitAction = '2';
store.state.commit.commitMessage = 'testing 123';
- store.state.openFiles.forEach(localF => {
+ store.state.openFiles.forEach((localF) => {
store.state.entries[localF.path] = localF;
});
});
@@ -329,23 +342,11 @@ describe('IDE commit module actions', () => {
});
describe('success', () => {
- const COMMIT_RESPONSE = {
- id: '123456',
- short_id: '123',
- message: 'test message',
- committed_date: 'date',
- parent_ids: '321',
- stats: {
- additions: '1',
- deletions: '2',
- },
- };
-
beforeEach(() => {
jest.spyOn(service, 'commit').mockResolvedValue({ data: COMMIT_RESPONSE });
});
- it('calls service', done => {
+ it('calls service', (done) => {
store
.dispatch('commit/commitChanges')
.then(() => {
@@ -370,7 +371,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('sends lastCommit ID when not creating new branch', done => {
+ it('sends lastCommit ID when not creating new branch', (done) => {
store.state.commit.commitAction = '1';
store
@@ -397,7 +398,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('sets last Commit Msg', done => {
+ it('sets last Commit Msg', (done) => {
store
.dispatch('commit/commitChanges')
.then(() => {
@@ -410,7 +411,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('adds commit data to files', done => {
+ it('adds commit data to files', (done) => {
store
.dispatch('commit/commitChanges')
.then(() => {
@@ -423,7 +424,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('resets stores commit actions', done => {
+ it('resets stores commit actions', (done) => {
store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH;
store
@@ -435,7 +436,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('removes all staged files', done => {
+ it('removes all staged files', (done) => {
store
.dispatch('commit/commitChanges')
.then(() => {
@@ -446,7 +447,7 @@ describe('IDE commit module actions', () => {
});
describe('merge request', () => {
- it('redirects to new merge request page', done => {
+ it('redirects to new merge request page', (done) => {
jest.spyOn(eventHub, '$on').mockImplementation();
store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH;
@@ -456,9 +457,7 @@ describe('IDE commit module actions', () => {
.dispatch('commit/commitChanges')
.then(() => {
expect(visitUrl).toHaveBeenCalledWith(
- `webUrl/-/merge_requests/new?merge_request[source_branch]=${
- store.getters['commit/placeholderBranchName']
- }&merge_request[target_branch]=master&nav_source=webide`,
+ `webUrl/-/merge_requests/new?merge_request[source_branch]=${store.getters['commit/placeholderBranchName']}&merge_request[target_branch]=master&nav_source=webide`,
);
done();
@@ -466,7 +465,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('does not redirect to new merge request page when shouldCreateMR is not checked', done => {
+ it('does not redirect to new merge request page when shouldCreateMR is not checked', (done) => {
jest.spyOn(eventHub, '$on').mockImplementation();
store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH;
@@ -512,7 +511,7 @@ describe('IDE commit module actions', () => {
});
});
- it('shows failed message', done => {
+ it('shows failed message', (done) => {
store
.dispatch('commit/commitChanges')
.then(() => {
@@ -546,19 +545,7 @@ describe('IDE commit module actions', () => {
});
describe('first commit of a branch', () => {
- const COMMIT_RESPONSE = {
- id: '123456',
- short_id: '123',
- message: 'test message',
- committed_date: 'date',
- parent_ids: [],
- stats: {
- additions: '1',
- deletions: '2',
- },
- };
-
- it('commits TOGGLE_EMPTY_STATE mutation on empty repo', done => {
+ it('commits TOGGLE_EMPTY_STATE mutation on empty repo', (done) => {
jest.spyOn(service, 'commit').mockResolvedValue({ data: COMMIT_RESPONSE });
jest.spyOn(store, 'commit');
@@ -575,7 +562,7 @@ describe('IDE commit module actions', () => {
.catch(done.fail);
});
- it('does not commmit TOGGLE_EMPTY_STATE mutation on existing project', done => {
+ it('does not commmit TOGGLE_EMPTY_STATE mutation on existing project', (done) => {
COMMIT_RESPONSE.parent_ids.push('1234');
jest.spyOn(service, 'commit').mockResolvedValue({ data: COMMIT_RESPONSE });
jest.spyOn(store, 'commit');
@@ -596,7 +583,7 @@ describe('IDE commit module actions', () => {
});
describe('toggleShouldCreateMR', () => {
- it('commits both toggle and interacting with MR checkbox actions', done => {
+ it('commits both toggle and interacting with MR checkbox actions', (done) => {
testAction(
actions.toggleShouldCreateMR,
{},
diff --git a/spec/frontend/ide/stores/modules/commit/getters_spec.js b/spec/frontend/ide/stores/modules/commit/getters_spec.js
index adbfd7c6835..66ed51dbd13 100644
--- a/spec/frontend/ide/stores/modules/commit/getters_spec.js
+++ b/spec/frontend/ide/stores/modules/commit/getters_spec.js
@@ -103,7 +103,7 @@ describe('IDE commit module getters', () => {
expect(getters.preBuiltCommitMessage(state, null, rootState)).toBe('test commit message');
});
- ['changedFiles', 'stagedFiles'].forEach(key => {
+ ['changedFiles', 'stagedFiles'].forEach((key) => {
it('returns commitMessage with updated file', () => {
rootState[key].push({
path: 'test-file',
diff --git a/spec/frontend/ide/stores/modules/editor/setup_spec.js b/spec/frontend/ide/stores/modules/editor/setup_spec.js
index 71b5d7590c5..659bfb2742f 100644
--- a/spec/frontend/ide/stores/modules/editor/setup_spec.js
+++ b/spec/frontend/ide/stores/modules/editor/setup_spec.js
@@ -1,8 +1,9 @@
+import { cloneDeep } from 'lodash';
import Vuex from 'vuex';
import eventHub from '~/ide/eventhub';
import { createStoreOptions } from '~/ide/stores';
import { setupFileEditorsSync } from '~/ide/stores/modules/editor/setup';
-import { createTriggerRenamePayload } from '../../../helpers';
+import { createTriggerRenamePayload, createTriggerUpdatePayload } from '../../../helpers';
describe('~/ide/stores/modules/editor/setup', () => {
let store;
@@ -33,6 +34,14 @@ describe('~/ide/stores/modules/editor/setup', () => {
});
});
+ it('when files update is emitted, does nothing', () => {
+ const origState = cloneDeep(store.state);
+
+ eventHub.$emit('ide.files.change', createTriggerUpdatePayload('foo'));
+
+ expect(store.state).toEqual(origState);
+ });
+
it('when files rename is emitted, renames fileEditor', () => {
eventHub.$emit('ide.files.change', createTriggerRenamePayload('foo', 'foo_new'));
diff --git a/spec/frontend/ide/stores/modules/file_templates/actions_spec.js b/spec/frontend/ide/stores/modules/file_templates/actions_spec.js
index 6c1fa163a91..76898e83c7a 100644
--- a/spec/frontend/ide/stores/modules/file_templates/actions_spec.js
+++ b/spec/frontend/ide/stores/modules/file_templates/actions_spec.js
@@ -20,7 +20,7 @@ describe('IDE file templates actions', () => {
});
describe('requestTemplateTypes', () => {
- it('commits REQUEST_TEMPLATE_TYPES', done => {
+ it('commits REQUEST_TEMPLATE_TYPES', (done) => {
testAction(
actions.requestTemplateTypes,
null,
@@ -33,7 +33,7 @@ describe('IDE file templates actions', () => {
});
describe('receiveTemplateTypesError', () => {
- it('commits RECEIVE_TEMPLATE_TYPES_ERROR and dispatches setErrorMessage', done => {
+ it('commits RECEIVE_TEMPLATE_TYPES_ERROR and dispatches setErrorMessage', (done) => {
testAction(
actions.receiveTemplateTypesError,
null,
@@ -55,7 +55,7 @@ describe('IDE file templates actions', () => {
});
describe('receiveTemplateTypesSuccess', () => {
- it('commits RECEIVE_TEMPLATE_TYPES_SUCCESS', done => {
+ it('commits RECEIVE_TEMPLATE_TYPES_SUCCESS', (done) => {
testAction(
actions.receiveTemplateTypesSuccess,
'test',
@@ -81,7 +81,7 @@ describe('IDE file templates actions', () => {
});
});
- it('rejects if selectedTemplateType is empty', done => {
+ it('rejects if selectedTemplateType is empty', (done) => {
const dispatch = jest.fn().mockName('dispatch');
actions
@@ -94,7 +94,7 @@ describe('IDE file templates actions', () => {
});
});
- it('dispatches actions', done => {
+ it('dispatches actions', (done) => {
state.selectedTemplateType = { key: 'licenses' };
testAction(
@@ -121,7 +121,7 @@ describe('IDE file templates actions', () => {
mock.onGet(/api\/(.*)\/templates\/licenses/).replyOnce(500);
});
- it('dispatches actions', done => {
+ it('dispatches actions', (done) => {
state.selectedTemplateType = { key: 'licenses' };
testAction(
@@ -184,7 +184,7 @@ describe('IDE file templates actions', () => {
});
describe('receiveTemplateError', () => {
- it('dispatches setErrorMessage', done => {
+ it('dispatches setErrorMessage', (done) => {
testAction(
actions.receiveTemplateError,
'test',
@@ -217,7 +217,7 @@ describe('IDE file templates actions', () => {
.replyOnce(200, { content: 'testing content' });
});
- it('dispatches setFileTemplate if template already has content', done => {
+ it('dispatches setFileTemplate if template already has content', (done) => {
const template = { content: 'already has content' };
testAction(
@@ -230,7 +230,7 @@ describe('IDE file templates actions', () => {
);
});
- it('dispatches success', done => {
+ it('dispatches success', (done) => {
const template = { key: 'mit' };
state.selectedTemplateType = { key: 'licenses' };
@@ -245,7 +245,7 @@ describe('IDE file templates actions', () => {
);
});
- it('dispatches success and uses name key for API call', done => {
+ it('dispatches success and uses name key for API call', (done) => {
const template = { name: 'testing' };
state.selectedTemplateType = { key: 'licenses' };
@@ -266,7 +266,7 @@ describe('IDE file templates actions', () => {
mock.onGet(/api\/(.*)\/templates\/licenses\/mit/).replyOnce(500);
});
- it('dispatches error', done => {
+ it('dispatches error', (done) => {
const template = { name: 'testing' };
state.selectedTemplateType = { key: 'licenses' };
diff --git a/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js b/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js
index ec472ab418f..6594d65f558 100644
--- a/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js
+++ b/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js
@@ -1,4 +1,5 @@
import MockAdapter from 'axios-mock-adapter';
+import testAction from 'helpers/vuex_action_helper';
import axios from '~/lib/utils/axios_utils';
import state from '~/ide/stores/modules/merge_requests/state';
import * as types from '~/ide/stores/modules/merge_requests/mutation_types';
@@ -10,7 +11,6 @@ import {
resetMergeRequests,
} from '~/ide/stores/modules/merge_requests/actions';
import { mergeRequests } from '../../../mock_data';
-import testAction from '../../../../helpers/vuex_action_helper';
describe('IDE merge requests actions', () => {
let mockedState;
@@ -28,7 +28,7 @@ describe('IDE merge requests actions', () => {
});
describe('requestMergeRequests', () => {
- it('should commit request', done => {
+ it('should commit request', (done) => {
testAction(
requestMergeRequests,
null,
@@ -41,7 +41,7 @@ describe('IDE merge requests actions', () => {
});
describe('receiveMergeRequestsError', () => {
- it('should commit error', done => {
+ it('should commit error', (done) => {
testAction(
receiveMergeRequestsError,
{ type: 'created', search: '' },
@@ -64,7 +64,7 @@ describe('IDE merge requests actions', () => {
});
describe('receiveMergeRequestsSuccess', () => {
- it('should commit received data', done => {
+ it('should commit received data', (done) => {
testAction(
receiveMergeRequestsSuccess,
mergeRequests,
@@ -118,7 +118,7 @@ describe('IDE merge requests actions', () => {
});
});
- it('dispatches success with received data', done => {
+ it('dispatches success with received data', (done) => {
testAction(
fetchMergeRequests,
{ type: 'created' },
@@ -156,7 +156,7 @@ describe('IDE merge requests actions', () => {
);
});
- it('dispatches success with received data', done => {
+ it('dispatches success with received data', (done) => {
testAction(
fetchMergeRequests,
{ type: null },
@@ -177,7 +177,7 @@ describe('IDE merge requests actions', () => {
mock.onGet(/\/api\/v4\/merge_requests(.*)$/).replyOnce(500);
});
- it('dispatches error', done => {
+ it('dispatches error', (done) => {
testAction(
fetchMergeRequests,
{ type: 'created', search: '' },
@@ -195,7 +195,7 @@ describe('IDE merge requests actions', () => {
});
describe('resetMergeRequests', () => {
- it('commits reset', done => {
+ it('commits reset', (done) => {
testAction(
resetMergeRequests,
null,
diff --git a/spec/frontend/ide/stores/modules/pane/actions_spec.js b/spec/frontend/ide/stores/modules/pane/actions_spec.js
index 8c56714e0ed..42fe8b400b8 100644
--- a/spec/frontend/ide/stores/modules/pane/actions_spec.js
+++ b/spec/frontend/ide/stores/modules/pane/actions_spec.js
@@ -7,18 +7,18 @@ describe('IDE pane module actions', () => {
const TEST_VIEW_KEEP_ALIVE = { name: 'test-keep-alive', keepAlive: true };
describe('toggleOpen', () => {
- it('dispatches open if closed', done => {
+ it('dispatches open if closed', (done) => {
testAction(actions.toggleOpen, TEST_VIEW, { isOpen: false }, [], [{ type: 'open' }], done);
});
- it('dispatches close if opened', done => {
+ it('dispatches close if opened', (done) => {
testAction(actions.toggleOpen, TEST_VIEW, { isOpen: true }, [], [{ type: 'close' }], done);
});
});
describe('open', () => {
describe('with a view specified', () => {
- it('commits SET_OPEN and SET_CURRENT_VIEW', done => {
+ it('commits SET_OPEN and SET_CURRENT_VIEW', (done) => {
testAction(
actions.open,
TEST_VIEW,
@@ -32,7 +32,7 @@ describe('IDE pane module actions', () => {
);
});
- it('commits KEEP_ALIVE_VIEW if keepAlive is true', done => {
+ it('commits KEEP_ALIVE_VIEW if keepAlive is true', (done) => {
testAction(
actions.open,
TEST_VIEW_KEEP_ALIVE,
@@ -49,7 +49,7 @@ describe('IDE pane module actions', () => {
});
describe('without a view specified', () => {
- it('commits SET_OPEN', done => {
+ it('commits SET_OPEN', (done) => {
testAction(
actions.open,
undefined,
@@ -63,7 +63,7 @@ describe('IDE pane module actions', () => {
});
describe('close', () => {
- it('commits SET_OPEN', done => {
+ it('commits SET_OPEN', (done) => {
testAction(actions.close, null, {}, [{ type: types.SET_OPEN, payload: false }], [], done);
});
});
diff --git a/spec/frontend/ide/stores/modules/pipelines/actions_spec.js b/spec/frontend/ide/stores/modules/pipelines/actions_spec.js
index 8511843cc92..b7ed257e954 100644
--- a/spec/frontend/ide/stores/modules/pipelines/actions_spec.js
+++ b/spec/frontend/ide/stores/modules/pipelines/actions_spec.js
@@ -1,6 +1,7 @@
import Visibility from 'visibilityjs';
import MockAdapter from 'axios-mock-adapter';
import { TEST_HOST } from 'helpers/test_constants';
+import testAction from 'helpers/vuex_action_helper';
import axios from '~/lib/utils/axios_utils';
import {
requestLatestPipeline,
@@ -24,7 +25,6 @@ import {
import state from '~/ide/stores/modules/pipelines/state';
import * as types from '~/ide/stores/modules/pipelines/mutation_types';
import { rightSidebarViews } from '~/ide/constants';
-import testAction from '../../../../helpers/vuex_action_helper';
import { pipelines, jobs } from '../../../mock_data';
describe('IDE pipelines actions', () => {
@@ -44,7 +44,7 @@ describe('IDE pipelines actions', () => {
});
describe('requestLatestPipeline', () => {
- it('commits request', done => {
+ it('commits request', (done) => {
testAction(
requestLatestPipeline,
null,
@@ -57,7 +57,7 @@ describe('IDE pipelines actions', () => {
});
describe('receiveLatestPipelineError', () => {
- it('commits error', done => {
+ it('commits error', (done) => {
testAction(
receiveLatestPipelineError,
{ status: 404 },
@@ -68,7 +68,7 @@ describe('IDE pipelines actions', () => {
);
});
- it('dispatches setErrorMessage is not 404', done => {
+ it('dispatches setErrorMessage is not 404', (done) => {
testAction(
receiveLatestPipelineError,
{ status: 500 },
@@ -123,7 +123,7 @@ describe('IDE pipelines actions', () => {
.reply(200, { data: { foo: 'bar' } }, { 'poll-interval': '10000' });
});
- it('dispatches request', done => {
+ it('dispatches request', (done) => {
jest.spyOn(axios, 'get');
jest.spyOn(Visibility, 'hidden').mockReturnValue(false);
@@ -139,7 +139,7 @@ describe('IDE pipelines actions', () => {
jest.advanceTimersByTime(1000);
- new Promise(resolve => requestAnimationFrame(resolve))
+ new Promise((resolve) => requestAnimationFrame(resolve))
.then(() => {
expect(axios.get).toHaveBeenCalled();
expect(axios.get).toHaveBeenCalledTimes(1);
@@ -150,7 +150,7 @@ describe('IDE pipelines actions', () => {
jest.advanceTimersByTime(10000);
})
- .then(() => new Promise(resolve => requestAnimationFrame(resolve)))
+ .then(() => new Promise((resolve) => requestAnimationFrame(resolve)))
.then(() => {
expect(axios.get).toHaveBeenCalled();
expect(axios.get).toHaveBeenCalledTimes(2);
@@ -169,7 +169,7 @@ describe('IDE pipelines actions', () => {
mock.onGet('/abc/def/commit/abc123def456ghi789jkl/pipelines').reply(500);
});
- it('dispatches error', done => {
+ it('dispatches error', (done) => {
const dispatch = jest.fn().mockName('dispatch');
const rootGetters = {
lastCommit: { id: 'abc123def456ghi789jkl' },
@@ -180,7 +180,7 @@ describe('IDE pipelines actions', () => {
jest.advanceTimersByTime(1500);
- new Promise(resolve => requestAnimationFrame(resolve))
+ new Promise((resolve) => requestAnimationFrame(resolve))
.then(() => {
expect(dispatch).toHaveBeenCalledWith('receiveLatestPipelineError', expect.anything());
})
@@ -191,13 +191,13 @@ describe('IDE pipelines actions', () => {
});
describe('requestJobs', () => {
- it('commits request', done => {
+ it('commits request', (done) => {
testAction(requestJobs, 1, mockedState, [{ type: types.REQUEST_JOBS, payload: 1 }], [], done);
});
});
describe('receiveJobsError', () => {
- it('commits error', done => {
+ it('commits error', (done) => {
testAction(
receiveJobsError,
{ id: 1 },
@@ -220,7 +220,7 @@ describe('IDE pipelines actions', () => {
});
describe('receiveJobsSuccess', () => {
- it('commits data', done => {
+ it('commits data', (done) => {
testAction(
receiveJobsSuccess,
{ id: 1, data: jobs },
@@ -240,7 +240,7 @@ describe('IDE pipelines actions', () => {
mock.onGet(stage.dropdownPath).replyOnce(200, jobs);
});
- it('dispatches request', done => {
+ it('dispatches request', (done) => {
testAction(
fetchJobs,
stage,
@@ -260,7 +260,7 @@ describe('IDE pipelines actions', () => {
mock.onGet(stage.dropdownPath).replyOnce(500);
});
- it('dispatches error', done => {
+ it('dispatches error', (done) => {
testAction(
fetchJobs,
stage,
@@ -277,7 +277,7 @@ describe('IDE pipelines actions', () => {
});
describe('toggleStageCollapsed', () => {
- it('commits collapse', done => {
+ it('commits collapse', (done) => {
testAction(
toggleStageCollapsed,
1,
@@ -290,7 +290,7 @@ describe('IDE pipelines actions', () => {
});
describe('setDetailJob', () => {
- it('commits job', done => {
+ it('commits job', (done) => {
testAction(
setDetailJob,
'job',
@@ -301,7 +301,7 @@ describe('IDE pipelines actions', () => {
);
});
- it('dispatches rightPane/open as pipeline when job is null', done => {
+ it('dispatches rightPane/open as pipeline when job is null', (done) => {
testAction(
setDetailJob,
null,
@@ -312,7 +312,7 @@ describe('IDE pipelines actions', () => {
);
});
- it('dispatches rightPane/open as job', done => {
+ it('dispatches rightPane/open as job', (done) => {
testAction(
setDetailJob,
'job',
@@ -325,13 +325,13 @@ describe('IDE pipelines actions', () => {
});
describe('requestJobLogs', () => {
- it('commits request', done => {
+ it('commits request', (done) => {
testAction(requestJobLogs, null, mockedState, [{ type: types.REQUEST_JOB_LOGS }], [], done);
});
});
describe('receiveJobLogsError', () => {
- it('commits error', done => {
+ it('commits error', (done) => {
testAction(
receiveJobLogsError,
null,
@@ -354,7 +354,7 @@ describe('IDE pipelines actions', () => {
});
describe('receiveJobLogsSuccess', () => {
- it('commits data', done => {
+ it('commits data', (done) => {
testAction(
receiveJobLogsSuccess,
'data',
@@ -377,7 +377,7 @@ describe('IDE pipelines actions', () => {
mock.onGet(`${TEST_HOST}/project/builds/trace`).replyOnce(200, { html: 'html' });
});
- it('dispatches request', done => {
+ it('dispatches request', (done) => {
testAction(
fetchJobLogs,
null,
@@ -408,7 +408,7 @@ describe('IDE pipelines actions', () => {
mock.onGet(`${TEST_HOST}/project/builds/trace`).replyOnce(500);
});
- it('dispatches error', done => {
+ it('dispatches error', (done) => {
testAction(
fetchJobLogs,
null,
@@ -422,7 +422,7 @@ describe('IDE pipelines actions', () => {
});
describe('resetLatestPipeline', () => {
- it('commits reset mutations', done => {
+ it('commits reset mutations', (done) => {
testAction(
resetLatestPipeline,
null,
diff --git a/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js b/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js
index 7d2f5d5d710..d820bf0291e 100644
--- a/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js
+++ b/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js
@@ -137,7 +137,7 @@ describe('IDE pipelines mutations', () => {
mutations[types.RECEIVE_JOBS_SUCCESS](mockedState, { id: mockedState.stages[0].id, data });
expect(mockedState.stages[0].jobs.length).toBe(jobs.length);
expect(mockedState.stages[0].jobs).toEqual(
- jobs.map(job => ({
+ jobs.map((job) => ({
id: job.id,
name: job.name,
status: job.status,
diff --git a/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js
index 242b1579be7..05935f1db38 100644
--- a/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js
+++ b/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js
@@ -102,7 +102,7 @@ describe('IDE store terminal check actions', () => {
);
});
- [httpStatus.FORBIDDEN, httpStatus.NOT_FOUND].forEach(status => {
+ [httpStatus.FORBIDDEN, httpStatus.NOT_FOUND].forEach((status) => {
it(`hides tab, when status is ${status}`, () => {
const payload = { response: { status } };
diff --git a/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js
index d0ac2af3ffd..dd51786745f 100644
--- a/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js
+++ b/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js
@@ -281,7 +281,7 @@ describe('IDE store terminal session controls actions', () => {
);
});
- [httpStatus.NOT_FOUND, httpStatus.UNPROCESSABLE_ENTITY].forEach(status => {
+ [httpStatus.NOT_FOUND, httpStatus.UNPROCESSABLE_ENTITY].forEach((status) => {
it(`dispatches request and startSession on ${status}`, () => {
mock
.onPost(state.session.retryPath, { branch: rootState.currentBranchId, format: 'json' })
diff --git a/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js
index e25746e1dd1..0e123dce798 100644
--- a/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js
+++ b/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js
@@ -98,7 +98,7 @@ describe('IDE store terminal session controls actions', () => {
);
});
- [STOPPING, STOPPED, 'unexpected'].forEach(status => {
+ [STOPPING, STOPPED, 'unexpected'].forEach((status) => {
it(`kills session if status is ${status}`, () => {
return testAction(
actions.receiveSessionStatusSuccess,
diff --git a/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js b/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js
index 3fa57bde415..2ae7e8a8727 100644
--- a/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js
+++ b/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js
@@ -22,7 +22,7 @@ describe('ide/stores/modules/terminal_sync/actions', () => {
});
describe('upload', () => {
- it('uploads to mirror and sets success', done => {
+ it('uploads to mirror and sets success', (done) => {
mirror.upload.mockReturnValue(Promise.resolve());
testAction(
@@ -38,7 +38,7 @@ describe('ide/stores/modules/terminal_sync/actions', () => {
);
});
- it('sets error when failed', done => {
+ it('sets error when failed', (done) => {
const err = { message: 'it failed!' };
mirror.upload.mockReturnValue(Promise.reject(err));
@@ -54,7 +54,7 @@ describe('ide/stores/modules/terminal_sync/actions', () => {
});
describe('stop', () => {
- it('disconnects from mirror', done => {
+ it('disconnects from mirror', (done) => {
testAction(actions.stop, null, rootState, [{ type: types.STOP }], [], () => {
expect(mirror.disconnect).toHaveBeenCalled();
done();
@@ -83,7 +83,7 @@ describe('ide/stores/modules/terminal_sync/actions', () => {
};
});
- it('connects to mirror and sets success', done => {
+ it('connects to mirror and sets success', (done) => {
mirror.connect.mockReturnValue(Promise.resolve());
testAction(
diff --git a/spec/frontend/ide/stores/mutations/file_spec.js b/spec/frontend/ide/stores/mutations/file_spec.js
index fd39cf21635..9bbdac0ae25 100644
--- a/spec/frontend/ide/stores/mutations/file_spec.js
+++ b/spec/frontend/ide/stores/mutations/file_spec.js
@@ -128,7 +128,7 @@ describe('IDE store file mutations', () => {
localState.changedFiles[0],
localState.openFiles[0],
localFile,
- ].forEach(f => {
+ ].forEach((f) => {
expect(f).toEqual(
expect.objectContaining({
path,
@@ -142,7 +142,7 @@ describe('IDE store file mutations', () => {
});
describe('SET_FILE_RAW_DATA', () => {
- const callMutationForFile = f => {
+ const callMutationForFile = (f) => {
mutations.SET_FILE_RAW_DATA(localState, {
file: f,
raw: 'testing',
diff --git a/spec/frontend/ide/stores/plugins/terminal_sync_spec.js b/spec/frontend/ide/stores/plugins/terminal_sync_spec.js
index 2aa3e770e7d..0e5f4184679 100644
--- a/spec/frontend/ide/stores/plugins/terminal_sync_spec.js
+++ b/spec/frontend/ide/stores/plugins/terminal_sync_spec.js
@@ -4,6 +4,7 @@ import { SET_SESSION_STATUS } from '~/ide/stores/modules/terminal/mutation_types
import { RUNNING, STOPPING } from '~/ide/stores/modules/terminal/constants';
import { createStore } from '~/ide/stores';
import eventHub from '~/ide/eventhub';
+import { createTriggerUpdatePayload } from '../../helpers';
jest.mock('~/ide/lib/mirror');
@@ -51,6 +52,14 @@ describe('IDE stores/plugins/mirror', () => {
expect(store.dispatch).toHaveBeenCalledWith(ACTION_UPLOAD);
});
+ it('does nothing when ide.files.change is emitted with "update"', () => {
+ eventHub.$emit(FILES_CHANGE_EVENT, createTriggerUpdatePayload('foo'));
+
+ jest.runAllTimers();
+
+ expect(store.dispatch).not.toHaveBeenCalledWith(ACTION_UPLOAD);
+ });
+
describe('when session stops', () => {
beforeEach(() => {
store.commit(`terminal/${SET_SESSION_STATUS}`, STOPPING);
diff --git a/spec/frontend/ide/sync_router_and_store_spec.js b/spec/frontend/ide/sync_router_and_store_spec.js
index 20fd77c4dfb..ac0f6aefb69 100644
--- a/spec/frontend/ide/sync_router_and_store_spec.js
+++ b/spec/frontend/ide/sync_router_and_store_spec.js
@@ -17,7 +17,7 @@ describe('~/ide/sync_router_and_store', () => {
const getRouterCurrentPath = () => router.currentRoute.fullPath;
const getStoreCurrentPath = () => store.state.router.fullPath;
- const updateRouter = async path => {
+ const updateRouter = async (path) => {
if (getRouterCurrentPath() === path) {
return;
}
@@ -25,7 +25,7 @@ describe('~/ide/sync_router_and_store', () => {
router.push(path);
await waitForPromises();
};
- const updateStore = path => {
+ const updateStore = (path) => {
store.dispatch('router/push', path);
return waitForPromises();
};
diff --git a/spec/frontend/ide/utils_spec.js b/spec/frontend/ide/utils_spec.js
index 3b772c0b259..f467d174eeb 100644
--- a/spec/frontend/ide/utils_spec.js
+++ b/spec/frontend/ide/utils_spec.js
@@ -263,7 +263,7 @@ describe('WebIDE utils', () => {
it('reads a file and returns its output as a data url', () => {
const file = new File(['foo'], 'foo.png', { type: 'image/png' });
- return readFileAsDataURL(file).then(contents => {
+ return readFileAsDataURL(file).then((contents) => {
expect(contents).toBe('data:image/png;base64,Zm9v');
});
});