Commit b1f29131 authored by Nathan Friend's avatar Nathan Friend

Merge branch 'leipert-prettier-arrow-parens-15' into 'master'

Format files with prettier arrowParens [15/15]

See merge request gitlab-org/gitlab!50544
parents af616eea 85af3689
......@@ -1242,159 +1242,3 @@ spec/frontend/set_status_modal/set_status_modal_wrapper_spec.js
spec/frontend/shared/popover_spec.js
spec/frontend/shortcuts_spec.js
spec/frontend/sidebar/assignee_title_spec.js
## exciting-buck
spec/frontend/sidebar/components/assignees/collapsed_assignee_list_spec.js
spec/frontend/sidebar/components/severity/severity_spec.js
spec/frontend/sidebar/components/severity/sidebar_severity_spec.js
spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js
spec/frontend/sidebar/confidential/edit_form_spec.js
spec/frontend/sidebar/lock/edit_form_buttons_spec.js
spec/frontend/sidebar/lock/edit_form_spec.js
spec/frontend/sidebar/lock/issuable_lock_form_spec.js
spec/frontend/sidebar/participants_spec.js
spec/frontend/sidebar/reviewer_title_spec.js
spec/frontend/sidebar/sidebar_mediator_spec.js
spec/frontend/sidebar/sidebar_move_issue_spec.js
spec/frontend/sidebar/subscriptions_spec.js
spec/frontend/snippet/collapsible_input_spec.js
spec/frontend/snippets/components/embed_dropdown_spec.js
spec/frontend/snippets/components/snippet_blob_actions_edit_spec.js
spec/frontend/snippets/components/snippet_visibility_edit_spec.js
spec/frontend/snippets/utils/blob_spec.js
spec/frontend/static_site_editor/components/edit_area_spec.js
spec/frontend/static_site_editor/components/edit_meta_controls_spec.js
spec/frontend/static_site_editor/graphql/resolvers/file_spec.js
spec/frontend/static_site_editor/services/load_source_content_spec.js
spec/frontend/static_site_editor/services/submit_content_changes_spec.js
spec/frontend/syntax_highlight_spec.js
spec/frontend/task_list_spec.js
spec/frontend/tooltips/components/tooltips_spec.js
spec/frontend/tooltips/index_spec.js
spec/frontend/user_lists/components/add_user_modal_spec.js
spec/frontend/user_lists/components/edit_user_list_spec.js
spec/frontend/user_lists/components/new_user_list_spec.js
spec/frontend/user_lists/components/user_list_spec.js
## priceless-margulis
spec/frontend/user_popovers_spec.js
spec/frontend/vue_alerts_spec.js
spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js
spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js
spec/frontend/vue_mr_widget/components/artifacts_list_spec.js
spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js
spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js
spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js
spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js
spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js
spec/frontend/vue_mr_widget/deployment/deployment_spec.js
spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js
spec/frontend/vue_mr_widget/mr_widget_options_spec.js
spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js
spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js
spec/frontend/vue_shared/components/actions_button_spec.js
spec/frontend/vue_shared/components/alert_details_table_spec.js
spec/frontend/vue_shared/components/awards_list_spec.js
spec/frontend/vue_shared/components/ci_badge_link_spec.js
spec/frontend/vue_shared/components/commit_spec.js
spec/frontend/vue_shared/components/confirm_modal_spec.js
## trusting-antonelli
spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js
spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js
spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js
spec/frontend/vue_shared/components/deprecated_modal_2_spec.js
spec/frontend/vue_shared/components/diff_viewer/diff_viewer_spec.js
spec/frontend/vue_shared/components/diff_viewer/viewers/image_diff_viewer_spec.js
spec/frontend/vue_shared/components/dismissible_container_spec.js
spec/frontend/vue_shared/components/editor_lite_spec.js
spec/frontend/vue_shared/components/expand_button_spec.js
spec/frontend/vue_shared/components/file_finder/index_spec.js
spec/frontend/vue_shared/components/file_finder/item_spec.js
spec/frontend/vue_shared/components/file_tree_spec.js
spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js
spec/frontend/vue_shared/components/filtered_search_bar/store/modules/filters/test_helper.js
spec/frontend/vue_shared/components/gl_countdown_spec.js
spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
spec/frontend/vue_shared/components/issuable/issuable_header_warnings_spec.js
spec/frontend/vue_shared/components/issue/issue_assignees_spec.js
spec/frontend/vue_shared/components/issue/issue_milestone_spec.js
spec/frontend/vue_shared/components/local_storage_sync_spec.js
spec/frontend/vue_shared/components/markdown/apply_suggestion_spec.js
spec/frontend/vue_shared/components/markdown/header_spec.js
spec/frontend/vue_shared/components/markdown/suggestions_spec.js
spec/frontend/vue_shared/components/markdown/toolbar_button_spec.js
spec/frontend/vue_shared/components/notes/noteable_warning_spec.js
spec/frontend/vue_shared/components/ordered_layout_spec.js
spec/frontend/vue_shared/components/pagination_links_spec.js
spec/frontend/vue_shared/components/project_avatar/default_spec.js
spec/frontend/vue_shared/components/registry/details_row_spec.js
spec/frontend/vue_shared/components/registry/list_item_spec.js
spec/frontend/vue_shared/components/registry/metadata_item_spec.js
spec/frontend/vue_shared/components/registry/title_area_spec.js
## wizardly-agnesi
spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js
spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js
spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js
spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js
spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js
spec/frontend/vue_shared/components/security_reports/help_icon_spec.js
spec/frontend/vue_shared/components/security_reports/security_summary_spec.js
spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js
spec/frontend/vue_shared/components/slot_switch_spec.js
spec/frontend/vue_shared/components/split_button_spec.js
spec/frontend/vue_shared/components/table_pagination_spec.js
spec/frontend/vue_shared/components/tabs/tab_spec.js
spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js
spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js
spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js
spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
spec/frontend/vue_shared/directives/validation_spec.js
spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js
spec/frontend/vue_shared/security_reports/security_reports_app_spec.js
spec/frontend/vue_shared/security_reports/store/getters_spec.js
spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js
spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js
## upbeat-elion
spec/frontend/vuex_shared/modules/modal/actions_spec.js
spec/frontend/whats_new/components/app_spec.js
spec/frontend/wikis_spec.js
spec/frontend_integration/ide/ide_integration_spec.js
spec/frontend_integration/test_helpers/fixtures.js
spec/frontend_integration/test_helpers/mock_server/index.js
spec/frontend_integration/test_helpers/mock_server/routes/404.js
spec/frontend_integration/test_helpers/mock_server/routes/ci.js
spec/frontend_integration/test_helpers/mock_server/routes/graphql.js
spec/frontend_integration/test_helpers/mock_server/routes/index.js
spec/frontend_integration/test_helpers/mock_server/routes/projects.js
spec/frontend_integration/test_helpers/mock_server/routes/repository.js
spec/frontend_integration/test_helpers/snapshot_serializer.js
spec/javascripts/fly_out_nav_browser_spec.js
spec/javascripts/lib/utils/browser_spec.js
spec/javascripts/matchers.js
spec/javascripts/test_bundle.js
......@@ -101,7 +101,7 @@ describe('CollapsedAssigneeList component', () => {
beforeEach(() => {
users = UsersMockHelper.createNumberRandomUsers(3);
userNames = users.map(x => x.name).join(', ');
userNames = users.map((x) => x.name).join(', ');
});
describe('default', () => {
......
......@@ -24,7 +24,7 @@ describe('SeverityToken', () => {
const findIcon = () => wrapper.find(GlIcon);
it('renders severity token for each severity type', () => {
Object.values(INCIDENT_SEVERITY).forEach(severity => {
Object.values(INCIDENT_SEVERITY).forEach((severity) => {
createComponent({ severity });
expect(findIcon().classes()).toContain(`icon-${severity.icon}`);
expect(findIcon().attributes('name')).toBe(`severity-${severity.icon}`);
......
......@@ -94,7 +94,7 @@ describe('SidebarSeverity', () => {
let resolvePromise;
wrapper.vm.$apollo.mutate = jest.fn(
() =>
new Promise(resolve => {
new Promise((resolve) => {
resolvePromise = resolve;
}),
);
......
......@@ -6,7 +6,7 @@ import TimeTracker from '~/sidebar/components/time_tracking/time_tracker.vue';
describe('Issuable Time Tracker', () => {
let wrapper;
const findByTestId = testId => wrapper.find(`[data-testid=${testId}]`);
const findByTestId = (testId) => wrapper.find(`[data-testid=${testId}]`);
const findComparisonMeter = () => findByTestId('compareMeter').attributes('title');
const findCollapsedState = () => findByTestId('collapsedState');
const findTimeRemainingProgress = () => findByTestId('timeRemainingProgress');
......
......@@ -6,7 +6,7 @@ describe('Edit Form Dropdown', () => {
const toggleForm = () => {};
const updateConfidentialAttribute = () => {};
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(EditForm, {
propsData: {
...props,
......
......@@ -15,7 +15,7 @@ describe('EditFormButtons', () => {
let issuableType;
let issuableDisplayName;
const setIssuableType = pageType => {
const setIssuableType = (pageType) => {
issuableType = pageType;
issuableDisplayName = issuableType.replace(/_/g, ' ');
};
......
......@@ -7,7 +7,7 @@ describe('Edit Form Dropdown', () => {
let issuableType; // Either ISSUABLE_TYPE_ISSUE or ISSUABLE_TYPE_MR
let issuableDisplayName;
const setIssuableType = pageType => {
const setIssuableType = (pageType) => {
issuableType = pageType;
issuableDisplayName = issuableType.replace(/_/g, ' ');
};
......
......@@ -12,7 +12,7 @@ describe('IssuableLockForm', () => {
let store;
let issuableType; // Either ISSUABLE_TYPE_ISSUE or ISSUABLE_TYPE_MR
const setIssuableType = pageType => {
const setIssuableType = (pageType) => {
issuableType = pageType;
};
......@@ -23,7 +23,7 @@ describe('IssuableLockForm', () => {
const findSidebarLockStatusTooltip = () =>
getBinding(findSidebarCollapseIcon().element, 'gl-tooltip');
const initStore = isLocked => {
const initStore = (isLocked) => {
if (issuableType === ISSUABLE_TYPE_ISSUE) {
store = createStore();
store.getters.getNoteableData.targetType = 'issue';
......
......@@ -21,7 +21,7 @@ describe('Participants', () => {
const getCollapsedParticipantsCount = () => wrapper.find('[data-testid="collapsed-count"]');
const mountComponent = propsData =>
const mountComponent = (propsData) =>
shallowMount(Participants, {
propsData,
});
......
......@@ -6,7 +6,7 @@ import Component from '~/sidebar/components/reviewers/reviewer_title.vue';
describe('ReviewerTitle component', () => {
let wrapper;
const createComponent = props => {
const createComponent = (props) => {
return shallowMount(Component, {
propsData: {
numberOfReviewers: 0,
......
......@@ -33,7 +33,7 @@ describe('Sidebar mediator', () => {
it('saves assignees', () => {
mock.onPut(mediatorMockData.endpoint).reply(200, {});
return mediator.saveAssignees('issue[assignee_ids]').then(resp => {
return mediator.saveAssignees('issue[assignee_ids]').then((resp) => {
expect(resp.status).toEqual(200);
});
});
......
......@@ -74,7 +74,7 @@ describe('SidebarMoveIssue', () => {
expect(test.sidebarMoveIssue.$dropdownToggle.data('deprecatedJQueryDropdown')).toBeTruthy();
});
it('escapes html from project name', done => {
it('escapes html from project name', (done) => {
test.$toggleButton.dropdown('toggle');
setImmediate(() => {
......@@ -98,7 +98,7 @@ describe('SidebarMoveIssue', () => {
expect(test.$confirmButton.hasClass('is-loading')).toBe(true);
});
it('should remove loading state from confirm button on failure', done => {
it('should remove loading state from confirm button on failure', (done) => {
jest.spyOn(window, 'Flash').mockImplementation(() => {});
jest.spyOn(test.mediator, 'moveIssue').mockReturnValue(Promise.reject());
test.mediator.setMoveToProjectId(7);
......@@ -125,7 +125,7 @@ describe('SidebarMoveIssue', () => {
});
});
it('should set moveToProjectId on dropdown item "No project" click', done => {
it('should set moveToProjectId on dropdown item "No project" click', (done) => {
jest.spyOn(test.mediator, 'setMoveToProjectId').mockImplementation(() => {});
// Open the dropdown
......@@ -141,7 +141,7 @@ describe('SidebarMoveIssue', () => {
});
});
it('should set moveToProjectId on dropdown item click', done => {
it('should set moveToProjectId on dropdown item click', (done) => {
jest.spyOn(test.mediator, 'setMoveToProjectId').mockImplementation(() => {});
// Open the dropdown
......
......@@ -8,7 +8,7 @@ describe('Subscriptions', () => {
const findToggleButton = () => wrapper.find(ToggleButton);
const mountComponent = propsData =>
const mountComponent = (propsData) =>
shallowMount(Subscriptions, {
propsData,
});
......
......@@ -38,12 +38,12 @@ describe('~/snippet/collapsible_input', () => {
setupCollapsibleInputs();
});
const findInput = el => el.querySelector('textarea,input');
const findCollapsed = el => el.querySelector('.js-collapsed');
const findExpanded = el => el.querySelector('.js-expanded');
const findCollapsedInput = el => findInput(findCollapsed(el));
const findExpandedInput = el => findInput(findExpanded(el));
const focusIn = target => target.dispatchEvent(new Event('focusin', { bubbles: true }));
const findInput = (el) => el.querySelector('textarea,input');
const findCollapsed = (el) => el.querySelector('.js-collapsed');
const findExpanded = (el) => el.querySelector('.js-expanded');
const findCollapsedInput = (el) => findInput(findCollapsed(el));
const findExpandedInput = (el) => findInput(findExpanded(el));
const focusIn = (target) => target.dispatchEvent(new Event('focusin', { bubbles: true }));
const expectIsCollapsed = (el, isCollapsed) => {
expect(findCollapsed(el).classList.contains('d-none')).toEqual(!isCollapsed);
expect(findExpanded(el).classList.contains('d-none')).toEqual(isCollapsed);
......
......@@ -26,7 +26,7 @@ describe('snippets/components/embed_dropdown', () => {
const sections = [];
let current = {};
wrapper.findAll('[data-testid="header"],[data-testid="input"]').wrappers.forEach(x => {
wrapper.findAll('[data-testid="header"],[data-testid="input"]').wrappers.forEach((x) => {
const type = x.attributes('data-testid');
if (type === 'header') {
......
......@@ -14,7 +14,7 @@ const TEST_BLOBS = [
createBlobFromTestEntry(testEntries.deleted),
];
const TEST_BLOBS_UNLOADED = TEST_BLOBS.map(blob => ({ ...blob, content: '', isLoaded: false }));
const TEST_BLOBS_UNLOADED = TEST_BLOBS.map((blob) => ({ ...blob, content: '', isLoaded: false }));
describe('snippets/components/snippet_blob_actions_edit', () => {
let wrapper;
......@@ -31,7 +31,7 @@ describe('snippets/components/snippet_blob_actions_edit', () => {
const findLabel = () => wrapper.find('label');
const findBlobEdits = () => wrapper.findAll(SnippetBlobEdit);
const findBlobsData = () =>
findBlobEdits().wrappers.map(x => ({
findBlobEdits().wrappers.map((x) => ({
blob: x.props('blob'),
classes: x.classes(),
}));
......@@ -42,7 +42,7 @@ describe('snippets/components/snippet_blob_actions_edit', () => {
return events[events.length - 1]?.[0];
};
const buildBlobsDataExpectation = blobs =>
const buildBlobsDataExpectation = (blobs) =>
blobs.map((blob, index) => ({
blob: {
...blob,
......@@ -50,7 +50,7 @@ describe('snippets/components/snippet_blob_actions_edit', () => {
},
classes: index > 0 ? ['gl-mt-3'] : [],
}));
const triggerBlobDelete = idx => findBlobEdits().at(idx).vm.$emit('delete');
const triggerBlobDelete = (idx) => findBlobEdits().at(idx).vm.$emit('delete');
const triggerBlobUpdate = (idx, props) => findBlobEdits().at(idx).vm.$emit('blob-updated', props);
afterEach(() => {
......
......@@ -40,7 +40,7 @@ describe('Snippet Visibility Edit component', () => {
const findLink = () => wrapper.find('label').find(GlLink);
const findRadios = () => wrapper.find(GlFormRadioGroup).findAll(GlFormRadio);
const findRadiosData = () =>
findRadios().wrappers.map(x => {
findRadios().wrappers.map((x) => {
return {
value: x.find('input').attributes('value'),
icon: x.find(GlIcon).props('name'),
......
......@@ -2,7 +2,7 @@ import { cloneDeep } from 'lodash';
import { decorateBlob, createBlob, diffAll } from '~/snippets/utils/blob';
import { testEntries, createBlobsFromTestEntries } from '../test_utils';
jest.mock('lodash/uniqueId', () => arg => `${arg}fakeUniqueId`);
jest.mock('lodash/uniqueId', () => (arg) => `${arg}fakeUniqueId`);
const TEST_RAW_BLOB = {
rawPath: '/test/blob/7/raw',
......
......@@ -22,7 +22,7 @@ import {
imageRoot,
} from '../mock_data';
jest.mock('~/static_site_editor/services/formatter', () => jest.fn(str => `${str} format-pass`));
jest.mock('~/static_site_editor/services/formatter', () => jest.fn((str) => `${str} format-pass`));
describe('~/static_site_editor/components/edit_area.vue', () => {
let wrapper;
......@@ -126,7 +126,7 @@ describe('~/static_site_editor/components/edit_area.vue', () => {
describe('when the mode changes', () => {
let resetInitialValue;
const setInitialMode = mode => {
const setInitialMode = (mode) => {
wrapper.setData({ editorMode: mode });
};
......
......@@ -35,7 +35,7 @@ describe('~/static_site_editor/components/edit_meta_controls.vue', () => {
const findGlFormInputTitle = () => wrapper.find(GlFormInput);
const findGlDropdownDescriptionTemplate = () => wrapper.find(GlDropdown);
const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem);
const findDropdownItemByIndex = index => findAllDropdownItems().at(index);
const findDropdownItemByIndex = (index) => findAllDropdownItems().at(index);
const findGlFormTextAreaDescription = () => wrapper.find(GlFormTextarea);
......
......@@ -14,7 +14,7 @@ describe('static_site_editor/graphql/resolvers/file', () => {
it('returns file content and title when fetching file successfully', () => {
loadSourceContent.mockResolvedValueOnce({ title, content });
return fileResolver({ fullPath: projectId }, { path: sourcePath }).then(file => {
return fileResolver({ fullPath: projectId }, { path: sourcePath }).then((file) => {
expect(file).toEqual({
__typename: 'File',
title,
......
......@@ -16,7 +16,7 @@ describe('loadSourceContent', () => {
beforeEach(() => {
jest.spyOn(Api, 'getRawFile').mockResolvedValue({ data: sourceContent });
return loadSourceContent({ projectId, sourcePath }).then(_result => {
return loadSourceContent({ projectId, sourcePath }).then((_result) => {
result = _result;
});
});
......
......@@ -188,7 +188,7 @@ describe('submitContentChanges', () => {
let result;
beforeEach(() => {
return submitContentChanges(buildPayload()).then(_result => {
return submitContentChanges(buildPayload()).then((_result) => {
result = _result;
});
});
......
......@@ -4,7 +4,7 @@ import $ from 'jquery';
import syntaxHighlight from '~/syntax_highlight';
describe('Syntax Highlighter', () => {
const stubUserColorScheme = value => {
const stubUserColorScheme = (value) => {
if (window.gon == null) {
window.gon = {};
}
......
......@@ -93,7 +93,7 @@ describe('TaskList', () => {
});
describe('update', () => {
it('should disable task list items and make a patch request then enable them again', done => {
it('should disable task list items and make a patch request then enable them again', (done) => {
const response = { data: { lock_version: 3 } };
jest.spyOn(taskList, 'enableTaskListItems').mockImplementation(() => {});
jest.spyOn(taskList, 'disableTaskListItems').mockImplementation(() => {});
......@@ -137,7 +137,7 @@ describe('TaskList', () => {
});
});
it('should handle request error and enable task list items', done => {
it('should handle request error and enable task list items', (done) => {
const response = { data: { error: 1 } };
jest.spyOn(taskList, 'enableTaskListItems').mockImplementation(() => {});
jest.spyOn(taskList, 'onError').mockImplementation(() => {});
......
......@@ -18,7 +18,7 @@ describe('tooltips/components/tooltips.vue', () => {
...attributes,
};
Object.keys(defaults).forEach(name => {
Object.keys(defaults).forEach((name) => {
target.setAttribute(name, defaults[name]);
});
......
......@@ -20,7 +20,7 @@ describe('tooltips/index.js', () => {
title: 'default title',
};
Object.keys(attributes).forEach(name => {
Object.keys(attributes).forEach((name) => {
target.setAttribute(name, attributes[name]);
});
......@@ -46,7 +46,7 @@ describe('tooltips/index.js', () => {
});
afterEach(() => {
document.body.childNodes.forEach(node => node.remove());
document.body.childNodes.forEach((node) => node.remove());
destroy();
});
......
......@@ -4,7 +4,7 @@ import AddUserModal from '~/user_lists/components/add_user_modal.vue';
describe('Add User Modal', () => {
let wrapper;
const click = testId => wrapper.find(`[data-testid="${testId}"]`).trigger('click');
const click = (testId) => wrapper.find(`[data-testid="${testId}"]`).trigger('click');
beforeEach(() => {
wrapper = mount(AddUserModal, {
......
......@@ -19,9 +19,9 @@ localVue.use(Vuex);
describe('user_lists/components/edit_user_list', () => {
let wrapper;
const setInputValue = value => wrapper.find('[data-testid="user-list-name"]').setValue(value);
const setInputValue = (value) => wrapper.find('[data-testid="user-list-name"]').setValue(value);
const click = button => wrapper.find(`[data-testid="${button}"]`).trigger('click');
const click = (button) => wrapper.find(`[data-testid="${button}"]`).trigger('click');
const clickSave = () => click('save-user-list');
const destroy = () => wrapper?.destroy();
......
......@@ -18,9 +18,9 @@ localVue.use(Vuex);
describe('user_lists/components/new_user_list', () => {
let wrapper;
const setInputValue = value => wrapper.find('[data-testid="user-list-name"]').setValue(value);
const setInputValue = (value) => wrapper.find('[data-testid="user-list-name"]').setValue(value);
const click = button => wrapper.find(`[data-testid="${button}"]`).trigger('click');
const click = (button) => wrapper.find(`[data-testid="${button}"]`).trigger('click');
beforeEach(() => {
wrapper = mount(NewUserList, {
......
......@@ -16,7 +16,7 @@ Vue.use(Vuex);
describe('User List', () => {
let wrapper;
const click = testId => wrapper.find(`[data-testid="${testId}"]`).trigger('click');
const click = (testId) => wrapper.find(`[data-testid="${testId}"]`).trigger('click');
const findUserIds = () => wrapper.findAll('[data-testid="user-id"]');
......@@ -38,7 +38,7 @@ describe('User List', () => {
beforeEach(() => {
Api.fetchFeatureFlagUserList.mockReturnValue(
new Promise(resolve => {
new Promise((resolve) => {
resolveFn = resolve;
}),
);
......@@ -110,15 +110,15 @@ describe('User List', () => {
});
it('should add user IDs to the user list', () => {
newIds.forEach(id => expect(receivedUserIds).toContain(id));
newIds.forEach((id) => expect(receivedUserIds).toContain(id));
});
it('should not remove existing user ids', () => {
userIds.forEach(id => expect(receivedUserIds).toContain(id));
userIds.forEach((id) => expect(receivedUserIds).toContain(id));
});
it('should not submit empty IDs', () => {
parsedReceivedUserIds.forEach(id => expect(id).not.toBe(''));
parsedReceivedUserIds.forEach((id) => expect(id).not.toBe(''));
});
it('should not create duplicate entries', () => {
......@@ -127,8 +127,8 @@ describe('User List', () => {
it('should display the new IDs', () => {
const userIdWrappers = findUserIds();
newIds.forEach(id => {
const userIdWrapper = userIdWrappers.wrappers.find(w => w.text() === id);
newIds.forEach((id) => {
const userIdWrapper = userIdWrappers.wrappers.find((w) => w.text() === id);
expect(userIdWrapper.exists()).toBe(true);
});
});
......@@ -150,7 +150,7 @@ describe('User List', () => {
it('should not display the deleted user', () => {
const userIdWrappers = findUserIds();
const userIdWrapper = userIdWrappers.wrappers.find(w => w.text() === userIds[0]);
const userIdWrapper = userIdWrappers.wrappers.find((w) => w.text() === userIds[0]);
expect(userIdWrapper).toBeUndefined();
});
});
......
......@@ -26,12 +26,12 @@ describe('User Popovers', () => {
loadFixtures(fixtureTemplate);
const usersCacheSpy = () => Promise.resolve(dummyUser);
jest.spyOn(UsersCache, 'retrieveById').mockImplementation(userId => usersCacheSpy(userId));
jest.spyOn(UsersCache, 'retrieveById').mockImplementation((userId) => usersCacheSpy(userId));
const userStatusCacheSpy = () => Promise.resolve(dummyUserStatus);
jest
.spyOn(UsersCache, 'retrieveStatusById')
.mockImplementation(userId => userStatusCacheSpy(userId));
.mockImplementation((userId) => userStatusCacheSpy(userId));
popovers = initUserPopovers(document.querySelectorAll(selector));
});
......
......@@ -27,7 +27,7 @@ describe('VueAlerts', () => {
setHTMLFixture(
alerts
.map(
x => `
(x) => `
<div class="js-vue-alert"
data-dismissible="${x.dismissible}"
data-title="${x.title}"
......@@ -42,15 +42,15 @@ describe('VueAlerts', () => {
const findJsHooks = () => document.querySelectorAll('.js-vue-alert');
const findAlerts = () => document.querySelectorAll('.gl-alert');
const findAlertDismiss = alert => alert.querySelector('.gl-alert-dismiss');
const findAlertDismiss = (alert) => alert.querySelector('.gl-alert-dismiss');
const serializeAlert = alert => ({
const serializeAlert = (alert) => ({
title: alert.querySelector('.gl-alert-title').textContent.trim(),
html: alert.querySelector('.gl-alert-body div').innerHTML,
dismissible: Boolean(alert.querySelector('.gl-alert-dismiss')),
primaryButtonText: alert.querySelector('.gl-alert-action').textContent.trim(),
primaryButtonLink: alert.querySelector('.gl-alert-action').href,
variant: [...alert.classList].find(x => x.match('gl-alert-')).replace('gl-alert-', ''),
variant: [...alert.classList].find((x) => x.match('gl-alert-')).replace('gl-alert-', ''),
});
it('starts with only JsHooks', () => {
......
......@@ -15,10 +15,10 @@ import eventHub from '~/vue_merge_request_widget/event_hub';
jest.mock('~/flash');
const TEST_HELP_PATH = 'help/path';
const testApprovedBy = () => [1, 7, 10].map(id => ({ id }));
const testApprovedBy = () => [1, 7, 10].map((id) => ({ id }));
const testApprovals = () => ({
approved: false,
approved_by: testApprovedBy().map(user => ({ user })),
approved_by: testApprovedBy().map((user) => ({ user })),
approval_rules_left: [],
approvals_left: 4,
suggested_approvers: [],
......@@ -31,7 +31,7 @@ const testApprovalRulesResponse = () => ({ rules: [{ id: 2 }] });
// For some reason, the `Promise.resolve()` needs to be deferred
// or the timing doesn't work.
const tick = () => Promise.resolve();
const waitForTick = done => tick().then(done).catch(done.fail);
const waitForTick = (done) => tick().then(done).catch(done.fail);
describe('MRWidget approvals', () => {
let wrapper;
......@@ -114,7 +114,7 @@ describe('MRWidget approvals', () => {
});
describe('when fetch approvals error', () => {
beforeEach(done => {
beforeEach((done) => {
jest.spyOn(service, 'fetchApprovals').mockReturnValue(Promise.reject());
createComponent();
waitForTick(done);
......@@ -131,7 +131,7 @@ describe('MRWidget approvals', () => {
describe('action button', () => {
describe('when mr is closed', () => {
beforeEach(done => {
beforeEach((done) => {
mr.isOpen = false;
mr.approvals.user_has_approved = false;
mr.approvals.user_can_approve = true;
......@@ -146,7 +146,7 @@ describe('MRWidget approvals', () => {
});
describe('when user cannot approve', () => {
beforeEach(done => {
beforeEach((done) => {
mr.approvals.user_has_approved = false;
mr.approvals.user_can_approve = false;
......@@ -166,7 +166,7 @@ describe('MRWidget approvals', () => {
});
describe('and MR is unapproved', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent();
waitForTick(done);
});
......@@ -186,7 +186,7 @@ describe('MRWidget approvals', () => {
});
describe('with no approvers', () => {
beforeEach(done => {
beforeEach((done) => {
mr.approvals.approved_by = [];
createComponent();
waitForTick(done);
......@@ -202,7 +202,7 @@ describe('MRWidget approvals', () => {
});
describe('with approvers', () => {
beforeEach(done => {
beforeEach((done) => {
mr.approvals.approved_by = [{ user: { id: 7 } }];
createComponent();
waitForTick(done);
......@@ -219,7 +219,7 @@ describe('MRWidget approvals', () => {
});
describe('when approve action is clicked', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent();
waitForTick(done);
});
......@@ -238,7 +238,7 @@ describe('MRWidget approvals', () => {
});
describe('and after loading', () => {
beforeEach(done => {
beforeEach((done) => {
findAction().vm.$emit('click');
waitForTick(done);
});
......@@ -257,7 +257,7 @@ describe('MRWidget approvals', () => {
});
describe('and error', () => {
beforeEach(done => {
beforeEach((done) => {
jest.spyOn(service, 'approveMergeRequest').mockReturnValue(Promise.reject());
findAction().vm.$emit('click');
waitForTick(done);
......@@ -271,7 +271,7 @@ describe('MRWidget approvals', () => {
});
describe('when user has approved', () => {
beforeEach(done => {
beforeEach((done) => {
mr.approvals.user_has_approved = true;
mr.approvals.user_can_approve = false;
......@@ -289,7 +289,7 @@ describe('MRWidget approvals', () => {
describe('when revoke action is clicked', () => {
describe('and successful', () => {
beforeEach(done => {
beforeEach((done) => {
findAction().vm.$emit('click');
waitForTick(done);
});
......@@ -308,7 +308,7 @@ describe('MRWidget approvals', () => {
});
describe('and error', () => {
beforeEach(done => {
beforeEach((done) => {
jest.spyOn(service, 'unapproveMergeRequest').mockReturnValue(Promise.reject());
findAction().vm.$emit('click');
waitForTick(done);
......@@ -331,7 +331,7 @@ describe('MRWidget approvals', () => {
});
describe('and can approve', () => {
beforeEach(done => {
beforeEach((done) => {
mr.approvals.user_can_approve = true;
createComponent();
......@@ -348,7 +348,7 @@ describe('MRWidget approvals', () => {
});
describe('and cannot approve', () => {
beforeEach(done => {
beforeEach((done) => {
mr.approvals.user_can_approve = false;
createComponent();
......@@ -367,7 +367,7 @@ describe('MRWidget approvals', () => {
});
describe('approvals summary', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent();
waitForTick(done);
});
......
......@@ -4,7 +4,7 @@ import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/ap
import { toNounSeriesText } from '~/lib/utils/grammar';
import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue';
const testApprovers = () => Array.from({ length: 5 }, (_, i) => i).map(id => ({ id }));
const testApprovers = () => Array.from({ length: 5 }, (_, i) => i).map((id) => ({ id }));
const testRulesLeft = () => ['Lorem', 'Ipsum', 'dolar & sit'];
const TEST_APPROVALS_LEFT = 3;
......
......@@ -10,7 +10,7 @@ describe('Artifacts List', () => {
artifacts: artifactsList,
};
const mountComponent = props => {
const mountComponent = (props) => {
wrapper = shallowMount(ArtifactsList, {
propsData: {
...props,
......
......@@ -8,7 +8,7 @@ describe('Merge Request Collapsible Extension', () => {
title: 'View artifacts',
};
const mountComponent = props => {
const mountComponent = (props) => {
wrapper = mount(MrCollapsibleSection, {
propsData: {
...props,
......
......@@ -19,7 +19,7 @@ describe('MrWidgetAlertMessage', () => {
});
describe('when type is not provided', () => {
it('should render a red message', done => {
it('should render a red message', (done) => {
wrapper.vm.$nextTick(() => {
expect(wrapper.classes()).toContain('danger_message');
expect(wrapper.classes()).not.toContain('warning_message');
......@@ -29,7 +29,7 @@ describe('MrWidgetAlertMessage', () => {
});
describe('when type === "danger"', () => {
it('should render a red message', done => {
it('should render a red message', (done) => {
wrapper.setProps({ type: 'danger' });
wrapper.vm.$nextTick(() => {
expect(wrapper.classes()).toContain('danger_message');
......@@ -40,7 +40,7 @@ describe('MrWidgetAlertMessage', () => {
});
describe('when type === "warning"', () => {
it('should render a red message', done => {
it('should render a red message', (done) => {
wrapper.setProps({ type: 'warning' });
wrapper.vm.$nextTick(() => {
expect(wrapper.classes()).toContain('warning_message');
......@@ -51,7 +51,7 @@ describe('MrWidgetAlertMessage', () => {
});
describe('when helpPath is not provided', () => {
it('should not render a help icon/link', done => {
it('should not render a help icon/link', (done) => {
wrapper.vm.$nextTick(() => {
const link = wrapper.find(GlLink);
......@@ -62,7 +62,7 @@ describe('MrWidgetAlertMessage', () => {
});
describe('when helpPath is provided', () => {
it('should render a help icon/link', done => {
it('should render a help icon/link', (done) => {
wrapper.setProps({ helpPath: '/path/to/help/docs' });
wrapper.vm.$nextTick(() => {
const link = wrapper.find(GlLink);
......
......@@ -187,7 +187,7 @@ describe('MRWidgetHeader', () => {
expect(link.getAttribute('href')).toBeNull();
});
it('renders web ide button with blank query string if target & source project branch', done => {
it('renders web ide button with blank query string if target & source project branch', (done) => {
vm.mr.targetProjectFullPath = 'root/gitlab-ce';
vm.$nextTick(() => {
......@@ -202,7 +202,7 @@ describe('MRWidgetHeader', () => {
});
});
it('renders web ide button with relative URL', done => {
it('renders web ide button with relative URL', (done) => {
gon.relative_url_root = '/gitlab';
vm.mr.iid = 2;
......
......@@ -153,13 +153,13 @@ describe('MemoryUsage', () => {
describe('loadMetrics', () => {
const returnServicePromise = () =>
new Promise(resolve => {
new Promise((resolve) => {
resolve({
data: metricsMockData,
});
});
it('should load metrics data using MRWidgetService', done => {
it('should load metrics data using MRWidgetService', (done) => {
jest.spyOn(MRWidgetService, 'fetchMetrics').mockReturnValue(returnServicePromise(true));
jest.spyOn(vm, 'computeGraphData').mockImplementation(() => {});
......@@ -179,7 +179,7 @@ describe('MemoryUsage', () => {
expect(el.querySelector('.js-usage-info')).toBeDefined();
});
it('should show loading metrics message while metrics are being loaded', done => {
it('should show loading metrics message while metrics are being loaded', (done) => {
vm.loadingMetrics = true;
vm.hasMetrics = false;
vm.loadFailed = false;
......@@ -194,7 +194,7 @@ describe('MemoryUsage', () => {
});
});
it('should show deployment memory usage when metrics are loaded', done => {
it('should show deployment memory usage when metrics are loaded', (done) => {
// ignore BoostrapVue warnings
jest.spyOn(console, 'warn').mockImplementation();
......@@ -210,7 +210,7 @@ describe('MemoryUsage', () => {
});
});
it('should show failure message when metrics loading failed', done => {
it('should show failure message when metrics loading failed', (done) => {
vm.loadingMetrics = false;
vm.hasMetrics = false;
vm.loadFailed = true;
......@@ -223,7 +223,7 @@ describe('MemoryUsage', () => {
});
});
it('should show metrics unavailable message when metrics loading failed', done => {
it('should show metrics unavailable message when metrics loading failed', (done) => {
vm.loadingMetrics = false;
vm.hasMetrics = false;
vm.loadFailed = false;
......
......@@ -46,7 +46,7 @@ describe('MrWidgetPipelineContainer', () => {
});
it('renders deployments', () => {
const expectedProps = mockStore.deployments.map(dep =>
const expectedProps = mockStore.deployments.map((dep) =>
expect.objectContaining({
deployment: dep,
showMetrics: false,
......@@ -55,7 +55,7 @@ describe('MrWidgetPipelineContainer', () => {
const deployments = wrapper.findAll('.mr-widget-extension .js-pre-deployment');
expect(deployments.wrappers.map(x => x.props())).toEqual(expectedProps);
expect(deployments.wrappers.map((x) => x.props())).toEqual(expectedProps);
});
});
......@@ -79,7 +79,7 @@ describe('MrWidgetPipelineContainer', () => {
});
it('renders deployments', () => {
const expectedProps = mockStore.postMergeDeployments.map(dep =>
const expectedProps = mockStore.postMergeDeployments.map((dep) =>
expect.objectContaining({
deployment: dep,
showMetrics: true,
......@@ -88,7 +88,7 @@ describe('MrWidgetPipelineContainer', () => {
const deployments = wrapper.findAll('.mr-widget-extension .js-post-deployment');
expect(deployments.wrappers.map(x => x.props())).toEqual(expectedProps);
expect(deployments.wrappers.map((x) => x.props())).toEqual(expectedProps);
});
});
......
......@@ -122,7 +122,7 @@ describe('MRWidgetPipeline', () => {
it.each(mockData.buildsWithCoverage)(
'should have name and coverage for build %s listed in tooltip',
build => {
(build) => {
const tooltipText = findPipelineCoverageTooltipText();
expect(tooltipText).toContain(`${build.name} (${build.coverage}%)`);
......
......@@ -49,7 +49,7 @@ describe('Merge request widget rebase component', () => {
);
});
it('it should render error message when it fails', done => {
it('it should render error message when it fails', (done) => {
vm.rebasingError = 'Something went wrong!';
Vue.nextTick(() => {
......@@ -98,7 +98,7 @@ describe('Merge request widget rebase component', () => {
});
describe('methods', () => {
it('checkRebaseStatus', done => {
it('checkRebaseStatus', (done) => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
vm = mountComponent(Component, {
mr: {},
......
......@@ -5,7 +5,7 @@ import relatedLinksComponent from '~/vue_merge_request_widget/components/mr_widg
describe('MRWidgetRelatedLinks', () => {
let vm;
const createComponent = data => {
const createComponent = (data) => {
const Component = Vue.extend(relatedLinksComponent);
return mountComponent(Component, data);
......
......@@ -108,12 +108,12 @@ describe('MRWidgetAutoMergeEnabled', () => {
describe('methods', () => {
describe('cancelAutomaticMerge', () => {
it('should set flag and call service then tell main component to update the widget with data', done => {
it('should set flag and call service then tell main component to update the widget with data', (done) => {
const mrObj = {
is_new_mr_data: true,
};
jest.spyOn(vm.service, 'cancelAutomaticMerge').mockReturnValue(
new Promise(resolve => {
new Promise((resolve) => {
resolve({
data: mrObj,
});
......@@ -130,7 +130,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
describe('removeSourceBranch', () => {
it('should set flag and call service then request main component to update the widget', done => {
it('should set flag and call service then request main component to update the widget', (done) => {
jest.spyOn(vm.service, 'merge').mockReturnValue(
Promise.resolve({
data: {
......@@ -173,7 +173,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
expect(vm.$el.querySelector('.js-remove-source-branch').getAttribute('disabled')).toBeFalsy();
});
it('should disable cancel auto merge button when the action is in progress', done => {
it('should disable cancel auto merge button when the action is in progress', (done) => {
vm.isCancellingAutoMerge = true;
Vue.nextTick(() => {
......@@ -182,7 +182,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
it('should show source branch will be deleted text when it source branch set to remove', done => {
it('should show source branch will be deleted text when it source branch set to remove', (done) => {
vm.mr.shouldRemoveSourceBranch = true;
Vue.nextTick(() => {
......@@ -194,7 +194,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
it('should not show delete source branch button when user not able to delete source branch', done => {
it('should not show delete source branch button when user not able to delete source branch', (done) => {
vm.mr.currentUserId = 4;
Vue.nextTick(() => {
......@@ -203,7 +203,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
it('should disable delete source branch button when the action is in progress', done => {
it('should disable delete source branch button when the action is in progress', (done) => {
vm.isRemovingSourceBranch = true;
Vue.nextTick(() => {
......@@ -214,7 +214,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
it('should render the status text as "...to merged automatically" if MWPS is selected', done => {
it('should render the status text as "...to merged automatically" if MWPS is selected', (done) => {
Vue.set(vm.mr, 'autoMergeStrategy', MWPS_MERGE_STRATEGY);
Vue.nextTick(() => {
......@@ -225,7 +225,7 @@ describe('MRWidgetAutoMergeEnabled', () => {
});
});
it('should render the cancel button as "Cancel automatic merge" if MWPS is selected', done => {
it('should render the cancel button as "Cancel automatic merge" if MWPS is selected', (done) => {
Vue.set(vm.mr, 'autoMergeStrategy', MWPS_MERGE_STRATEGY);
Vue.nextTick(() => {
......
......@@ -4,7 +4,7 @@ import CommitsHeader from '~/vue_merge_request_widget/components/states/commits_
describe('Commits header component', () => {
let wrapper;
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(CommitsHeader, {
propsData: {
isSquashEnabled: false,
......@@ -110,21 +110,21 @@ describe('Commits header component', () => {
wrapper.setData({ expanded: true });
});
it('toggle has aria-label equal to collapse', done => {
it('toggle has aria-label equal to collapse', (done) => {
wrapper.vm.$nextTick(() => {
expect(findCommitToggle().attributes('aria-label')).toBe('Collapse');
done();
});
});
it('has a chevron-down icon', done => {
it('has a chevron-down icon', (done) => {
wrapper.vm.$nextTick(() => {
expect(findCommitToggle().props('icon')).toBe('chevron-down');
done();
});
});
it('has a collapse text', done => {
it('has a collapse text', (done) => {
wrapper.vm.$nextTick(() => {
expect(findHeaderWrapper().text()).toBe('Collapse');
done();
......
......@@ -54,7 +54,7 @@ describe('MRWidgetConflicts', () => {
vm.destroy();
});
[false, true].forEach(featureEnabled => {
[false, true].forEach((featureEnabled) => {
describe(`with GraphQL feature flag ${featureEnabled ? 'enabled' : 'disabled'}`, () => {
beforeEach(() => {
mergeRequestWidgetGraphql = featureEnabled;
......
......@@ -49,7 +49,7 @@ describe('MRWidgetFailedToMerge', () => {
});
describe('mergeError', () => {
it('removes forced line breaks', done => {
it('removes forced line breaks', (done) => {
mr.mergeError = 'contains<br />line breaks<br />';
Vue.nextTick()
......@@ -98,7 +98,7 @@ describe('MRWidgetFailedToMerge', () => {
});
describe('while it is refreshing', () => {
it('renders Refresing now', done => {
it('renders Refresing now', (done) => {
vm.isRefreshing = true;
Vue.nextTick(() => {
......@@ -139,7 +139,7 @@ describe('MRWidgetFailedToMerge', () => {
});
});
it('should just generic merge failed message if merge_error is not available', done => {
it('should just generic merge failed message if merge_error is not available', (done) => {
vm.mr.mergeError = null;
Vue.nextTick(() => {
......@@ -149,7 +149,7 @@ describe('MRWidgetFailedToMerge', () => {
});
});
it('should show refresh label when refresh requested', done => {
it('should show refresh label when refresh requested', (done) => {
vm.refresh();
Vue.nextTick(() => {
expect(vm.$el.innerText).not.toContain('Merge failed. Refreshing');
......
......@@ -123,9 +123,9 @@ describe('MRWidgetMerged', () => {
describe('methods', () => {
describe('removeSourceBranch', () => {
it('should set flag and call service then request main component to update the widget', done => {
it('should set flag and call service then request main component to update the widget', (done) => {
jest.spyOn(vm.service, 'removeSourceBranch').mockReturnValue(
new Promise(resolve => {
new Promise((resolve) => {
resolve({
data: {
message: 'Branch was deleted',
......@@ -173,7 +173,7 @@ describe('MRWidgetMerged', () => {
);
});
it('hides button to copy commit SHA if SHA does not exist', done => {
it('hides button to copy commit SHA if SHA does not exist', (done) => {
vm.mr.mergeCommitSha = null;
Vue.nextTick(() => {
......@@ -189,7 +189,7 @@ describe('MRWidgetMerged', () => {
expect(selectors.mergeCommitShaLink.href).toBe(vm.mr.mergeCommitPath);
});
it('should not show source branch deleted text', done => {
it('should not show source branch deleted text', (done) => {
vm.mr.sourceBranchRemoved = false;
Vue.nextTick(() => {
......@@ -199,7 +199,7 @@ describe('MRWidgetMerged', () => {
});
});
it('should show source branch deleting text', done => {
it('should show source branch deleting text', (done) => {
vm.mr.isRemovingSourceBranch = true;
vm.mr.sourceBranchRemoved = false;
......
......@@ -25,7 +25,7 @@ describe('MRWidgetMissingBranch', () => {
wrapper.destroy();
});
[true, false].forEach(mergeRequestWidgetGraphql => {
[true, false].forEach((mergeRequestWidgetGraphql) => {
describe(`widget GraphQL feature flag is ${
mergeRequestWidgetGraphql ? 'enabled' : 'disabled'
}`, () => {
......
......@@ -20,7 +20,7 @@ jest.mock('~/commons/nav/user_merge_requests', () => ({
const commitMessage = 'This is the commit message';
const squashCommitMessage = 'This is the squash commit message';
const commitMessageWithDescription = 'This is the commit message description';
const createTestMr = customConfig => {
const createTestMr = (customConfig) => {
const mr = {
isPipelineActive: false,
pipeline: null,
......@@ -346,8 +346,8 @@ describe('ReadyToMerge', () => {
});
describe('handleMergeButtonClick', () => {
const returnPromise = status =>
new Promise(resolve => {
const returnPromise = (status) =>
new Promise((resolve) => {
resolve({
data: {
status,
......@@ -355,7 +355,7 @@ describe('ReadyToMerge', () => {
});
});
it('should handle merge when pipeline succeeds', done => {
it('should handle merge when pipeline succeeds', (done) => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
jest
.spyOn(vm.service, 'merge')
......@@ -381,7 +381,7 @@ describe('ReadyToMerge', () => {
});
});
it('should handle merge failed', done => {
it('should handle merge failed', (done) => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
jest.spyOn(vm.service, 'merge').mockReturnValue(returnPromise('failed'));
vm.handleMergeButtonClick(false, true);
......@@ -398,7 +398,7 @@ describe('ReadyToMerge', () => {
});
});
it('should handle merge action accepted case', done => {
it('should handle merge action accepted case', (done) => {
jest.spyOn(vm.service, 'merge').mockReturnValue(returnPromise('success'));
jest.spyOn(vm, 'initiateMergePolling').mockImplementation(() => {});
vm.handleMergeButtonClick();
......@@ -433,8 +433,8 @@ describe('ReadyToMerge', () => {
});
describe('handleMergePolling', () => {
const returnPromise = state =>
new Promise(resolve => {
const returnPromise = (state) =>
new Promise((resolve) => {
resolve({
data: {
state,
......@@ -447,7 +447,7 @@ describe('ReadyToMerge', () => {
loadFixtures('merge_requests/merge_request_of_current_user.html');
});
it('should call start and stop polling when MR merged', done => {
it('should call start and stop polling when MR merged', (done) => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged'));
jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {});
......@@ -476,7 +476,7 @@ describe('ReadyToMerge', () => {
});
});
it('updates status box', done => {
it('updates status box', (done) => {
jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged'));
jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {});
......@@ -495,7 +495,7 @@ describe('ReadyToMerge', () => {
});
});
it('updates merge request count badge', done => {
it('updates merge request count badge', (done) => {
jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged'));
jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {});
......@@ -511,7 +511,7 @@ describe('ReadyToMerge', () => {
});
});
it('should continue polling until MR is merged', done => {
it('should continue polling until MR is merged', (done) => {
jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('some_other_state'));
jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {});
......@@ -547,8 +547,8 @@ describe('ReadyToMerge', () => {
});
describe('handleRemoveBranchPolling', () => {
const returnPromise = state =>
new Promise(resolve => {
const returnPromise = (state) =>
new Promise((resolve) => {
resolve({
data: {
source_branch_exists: state,
......@@ -556,7 +556,7 @@ describe('ReadyToMerge', () => {
});
});
it('should call start and stop polling when MR merged', done => {
it('should call start and stop polling when MR merged', (done) => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise(false));
......@@ -589,7 +589,7 @@ describe('ReadyToMerge', () => {
});
});
it('should continue polling until MR is merged', done => {
it('should continue polling until MR is merged', (done) => {
jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise(true));
let cpc = false; // continuePollingCalled
......
......@@ -8,7 +8,7 @@ const localVue = createLocalVue();
describe('Squash before merge component', () => {
let wrapper;
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(localVue.extend(SquashBeforeMerge), {
localVue,
propsData: {
......
......@@ -47,12 +47,12 @@ describe('Wip', () => {
};
describe('handleRemoveWIP', () => {
it('should make a request to service and handle response', done => {
it('should make a request to service and handle response', (done) => {
const vm = createComponent();
jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
jest.spyOn(vm.service, 'removeWIP').mockReturnValue(
new Promise(resolve => {
new Promise((resolve) => {
resolve({
data: mrObj,
});
......@@ -92,7 +92,7 @@ describe('Wip', () => {
);
});
it('should not show removeWIP button is user cannot update MR', done => {
it('should not show removeWIP button is user cannot update MR', (done) => {
vm.mr.removeWIPPath = '';
Vue.nextTick(() => {
......
......@@ -15,7 +15,7 @@ describe('MrWidgetTerraformConainer', () => {
const propsData = { endpoint: '/path/to/terraform/report.json' };
const findHeader = () => wrapper.find('[data-testid="terraform-header-text"]');
const findPlans = () => wrapper.findAll(TerraformPlan).wrappers.map(x => x.props('plan'));
const findPlans = () => wrapper.findAll(TerraformPlan).wrappers.map((x) => x.props('plan'));
const mockPollingApi = (response, body, header) => {
mock.onGet(propsData.endpoint).reply(response, body, header);
......
......@@ -14,7 +14,7 @@ describe('TerraformPlan', () => {
const findIcon = () => wrapper.find('[data-testid="change-type-icon"]');
const findLogButton = () => wrapper.find('[data-testid="terraform-report-link"]');
const mountWrapper = propsData => {
const mountWrapper = (propsData) => {
wrapper = shallowMount(TerraformPlan, { stubs: { GlLink, GlSprintf }, propsData });
};
......
......@@ -116,7 +116,7 @@ describe('Deployment component', () => {
if (actionButtons.length > 0) {
describe('renders the expected button group', () => {
actionButtons.forEach(button => {
actionButtons.forEach((button) => {
it(`renders ${button}`, () => {
expect(wrapper.find(button).exists()).toBe(true);
});
......@@ -126,7 +126,7 @@ describe('Deployment component', () => {
if (actionButtons.length === 0) {
describe('does not render the button group', () => {
defaultGroup.forEach(button => {
defaultGroup.forEach((button) => {
it(`does not render ${button}`, () => {
expect(wrapper.find(button).exists()).toBe(false);
});
......
......@@ -90,7 +90,7 @@ describe('Deployment View App button', () => {
it('renders all the links to the review apps', () => {
const allUrls = wrapper.findAll('.js-deploy-url-menu-item').wrappers;
const expectedUrls = deploymentMockData.changes.map(change => change.external_url);
const expectedUrls = deploymentMockData.changes.map((change) => change.external_url);
expectedUrls.forEach((expectedUrl, idx) => {
const deployUrl = allUrls[idx];
......
......@@ -14,8 +14,8 @@ import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/consta
jest.mock('~/smart_interval');
const returnPromise = data =>
new Promise(resolve => {
const returnPromise = (data) =>
new Promise((resolve) => {
resolve({
data,
});
......@@ -180,7 +180,7 @@ describe('mrWidgetOptions', () => {
});
describe('when merge request is opened', () => {
beforeEach(done => {
beforeEach((done) => {
vm.mr.isOpen = true;
vm.$nextTick(done);
});
......@@ -191,7 +191,7 @@ describe('mrWidgetOptions', () => {
});
describe('when merge request is not opened', () => {
beforeEach(done => {
beforeEach((done) => {
vm.mr.isOpen = false;
vm.$nextTick(done);
});
......@@ -208,7 +208,7 @@ describe('mrWidgetOptions', () => {
});
describe('when merge request is opened', () => {
beforeEach(done => {
beforeEach((done) => {
vm.mr.isOpen = true;
vm.$nextTick(done);
});
......@@ -222,7 +222,7 @@ describe('mrWidgetOptions', () => {
describe('showMergePipelineForkWarning', () => {
describe('when the source project and target project are the same', () => {
beforeEach(done => {
beforeEach((done) => {
Vue.set(vm.mr, 'mergePipelinesEnabled', true);
Vue.set(vm.mr, 'sourceProjectId', 1);
Vue.set(vm.mr, 'targetProjectId', 1);
......@@ -235,7 +235,7 @@ describe('mrWidgetOptions', () => {
});
describe('when merge pipelines are not enabled', () => {
beforeEach(done => {
beforeEach((done) => {
Vue.set(vm.mr, 'mergePipelinesEnabled', false);
Vue.set(vm.mr, 'sourceProjectId', 1);
Vue.set(vm.mr, 'targetProjectId', 2);
......@@ -248,7 +248,7 @@ describe('mrWidgetOptions', () => {
});
describe('when merge pipelines are enabled _and_ the source project and target project are different', () => {
beforeEach(done => {
beforeEach((done) => {
Vue.set(vm.mr, 'mergePipelinesEnabled', true);
Vue.set(vm.mr, 'sourceProjectId', 1);
Vue.set(vm.mr, 'targetProjectId', 2);
......@@ -362,8 +362,8 @@ describe('mrWidgetOptions', () => {
describe('bindEventHubListeners', () => {
it.each`
event | method | methodArgs
${'MRWidgetUpdateRequested'} | ${'checkStatus'} | ${x => [x]}
${'MRWidgetRebaseSuccess'} | ${'checkStatus'} | ${x => [x, true]}
${'MRWidgetUpdateRequested'} | ${'checkStatus'} | ${(x) => [x]}
${'MRWidgetRebaseSuccess'} | ${'checkStatus'} | ${(x) => [x, true]}
${'FetchActionsContent'} | ${'fetchActionsContent'} | ${() => []}
${'EnablePolling'} | ${'resumePolling'} | ${() => []}
${'DisablePolling'} | ${'stopPolling'} | ${() => []}
......@@ -421,7 +421,7 @@ describe('mrWidgetOptions', () => {
document.body.removeChild(document.getElementById('favicon'));
});
it('should call setFavicon method', done => {
it('should call setFavicon method', (done) => {
vm.mr.ciStatusFaviconPath = overlayDataUrl;
vm.setFaviconHelper()
.then(() => {
......@@ -438,7 +438,7 @@ describe('mrWidgetOptions', () => {
.catch(done.fail);
});
it('should not call setFavicon when there is no ciStatusFaviconPath', done => {
it('should not call setFavicon when there is no ciStatusFaviconPath', (done) => {
vm.mr.ciStatusFaviconPath = null;
vm.setFaviconHelper()
.then(() => {
......@@ -513,7 +513,7 @@ describe('mrWidgetOptions', () => {
});
describe('rendering relatedLinks', () => {
beforeEach(done => {
beforeEach((done) => {
vm.mr.relatedLinks = {
assignToMe: null,
closing: `
......@@ -530,7 +530,7 @@ describe('mrWidgetOptions', () => {
expect(vm.$el.querySelector('.close-related-link')).toBeDefined();
});
it('does not render if state is nothingToMerge', done => {
it('does not render if state is nothingToMerge', (done) => {
vm.mr.state = stateKey.nothingToMerge;
Vue.nextTick(() => {
expect(vm.$el.querySelector('.close-related-link')).toBeNull();
......@@ -540,7 +540,7 @@ describe('mrWidgetOptions', () => {
});
describe('rendering source branch removal status', () => {
it('renders when user cannot remove branch and branch should be removed', done => {
it('renders when user cannot remove branch and branch should be removed', (done) => {
vm.mr.canRemoveSourceBranch = false;
vm.mr.shouldRemoveSourceBranch = true;
vm.mr.state = 'readyToMerge';
......@@ -557,7 +557,7 @@ describe('mrWidgetOptions', () => {
});
});
it('does not render in merged state', done => {
it('does not render in merged state', (done) => {
vm.mr.canRemoveSourceBranch = false;
vm.mr.shouldRemoveSourceBranch = true;
vm.mr.state = 'merged';
......@@ -601,7 +601,7 @@ describe('mrWidgetOptions', () => {
status: SUCCESS,
};
beforeEach(done => {
beforeEach((done) => {
vm.mr.deployments.push(
{
...deploymentMockData,
......@@ -636,7 +636,7 @@ describe('mrWidgetOptions', () => {
describe('pipeline for target branch after merge', () => {
describe('with information for target branch pipeline', () => {
beforeEach(done => {
beforeEach((done) => {
vm.mr.state = 'merged';
vm.mr.mergePipeline = {
id: 127,
......@@ -752,7 +752,7 @@ describe('mrWidgetOptions', () => {
});
describe('with post merge deployments', () => {
beforeEach(done => {
beforeEach((done) => {
vm.mr.postMergeDeployments = [
{
id: 15,
......@@ -795,7 +795,7 @@ describe('mrWidgetOptions', () => {
});
describe('without information for target branch pipeline', () => {
beforeEach(done => {
beforeEach((done) => {
vm.mr.state = 'merged';
vm.$nextTick(done);
......@@ -807,7 +807,7 @@ describe('mrWidgetOptions', () => {
});
describe('when state is not merged', () => {
beforeEach(done => {
beforeEach((done) => {
vm.mr.state = 'archived';
vm.$nextTick(done);
......@@ -887,7 +887,7 @@ describe('mrWidgetOptions', () => {
{ isDismissedSuggestPipeline: true },
{ mergeRequestAddCiConfigPath: null },
{ hasCI: true },
])('with %s, should not suggest pipeline', async obj => {
])('with %s, should not suggest pipeline', async (obj) => {
Object.assign(vm.mr, obj);
await vm.$nextTick();
......
......@@ -22,7 +22,7 @@ describe('Artifacts App Store Actions', () => {
});
describe('setEndpoint', () => {
it('should commit SET_ENDPOINT mutation', done => {
it('should commit SET_ENDPOINT mutation', (done) => {
testAction(
setEndpoint,
'endpoint.json',
......@@ -35,7 +35,7 @@ describe('Artifacts App Store Actions', () => {
});
describe('requestArtifacts', () => {
it('should commit REQUEST_ARTIFACTS mutation', done => {
it('should commit REQUEST_ARTIFACTS mutation', (done) => {
testAction(
requestArtifacts,
null,
......@@ -62,7 +62,7 @@ describe('Artifacts App Store Actions', () => {
});
describe('success', () => {
it('dispatches requestArtifacts and receiveArtifactsSuccess ', done => {
it('dispatches requestArtifacts and receiveArtifactsSuccess ', (done) => {
mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, [
{
text: 'result.txt',
......@@ -106,7 +106,7 @@ describe('Artifacts App Store Actions', () => {
mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500);
});
it('dispatches requestArtifacts and receiveArtifactsError ', done => {
it('dispatches requestArtifacts and receiveArtifactsError ', (done) => {
testAction(
fetchArtifacts,
null,
......@@ -127,7 +127,7 @@ describe('Artifacts App Store Actions', () => {
});
describe('receiveArtifactsSuccess', () => {
it('should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200', done => {
it('should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200', (done) => {
testAction(
receiveArtifactsSuccess,
{ data: { summary: {} }, status: 200 },
......@@ -138,7 +138,7 @@ describe('Artifacts App Store Actions', () => {
);
});
it('should not commit RECEIVE_ARTIFACTS_SUCCESS mutation with 204', done => {
it('should not commit RECEIVE_ARTIFACTS_SUCCESS mutation with 204', (done) => {
testAction(
receiveArtifactsSuccess,
{ data: { summary: {} }, status: 204 },
......@@ -151,7 +151,7 @@ describe('Artifacts App Store Actions', () => {
});
describe('receiveArtifactsError', () => {
it('should commit RECEIVE_ARTIFACTS_ERROR mutation', done => {
it('should commit RECEIVE_ARTIFACTS_ERROR mutation', (done) => {
testAction(
receiveArtifactsError,
null,
......
......@@ -156,7 +156,7 @@ describe('MergeRequestStore', () => {
it.each(['sast_comparison_path', 'secret_scanning_comparison_path'])(
'should set %s path',
property => {
(property) => {
// Ensure something is set in the mock data
expect(property in mockData).toBe(true);
const expectedValue = mockData[property];
......
......@@ -40,7 +40,7 @@ describe('Actions button component', () => {
wrapper.destroy();
});
const getTooltip = child => {
const getTooltip = (child) => {
const directiveBinding = getBinding(child.element, 'gl-tooltip');
return directiveBinding.value;
......@@ -52,7 +52,7 @@ describe('Actions button component', () => {
const parseDropdownItems = () =>
findDropdown()
.findAll('gl-dropdown-item-stub,gl-dropdown-divider-stub')
.wrappers.map(x => {
.wrappers.map((x) => {
if (x.is('gl-dropdown-divider-stub')) {
return { type: 'divider' };
}
......
......@@ -45,13 +45,13 @@ describe('AlertDetails', () => {
const findTableComponent = () => wrapper.find(GlTable);
const findTableKeys = () => findTableComponent().findAll('tbody td:first-child');
const findTableFieldValueByKey = fieldKey =>
const findTableFieldValueByKey = (fieldKey) =>
findTableComponent()
.findAll('tbody tr')
.filter(row => row.text().includes(fieldKey))
.filter((row) => row.text().includes(fieldKey))
.at(0)
.find('td:nth-child(2)');
const findTableField = (fields, fieldName) => fields.filter(row => row.text() === fieldName);
const findTableField = (fields, fieldName) => fields.filter((row) => row.text() === fieldName);
describe('Alert details', () => {
describe('empty state', () => {
......
......@@ -58,10 +58,10 @@ describe('vue_shared/components/awards_list', () => {
wrapper = mount(AwardsList, { propsData: props });
};
const matchingEmojiTag = name => expect.stringMatching(`gl-emoji data-name="${name}"`);
const matchingEmojiTag = (name) => expect.stringMatching(`gl-emoji data-name="${name}"`);
const findAwardButtons = () => wrapper.findAll('[data-testid="award-button"]');
const findAwardsData = () =>
findAwardButtons().wrappers.map(x => {
findAwardButtons().wrappers.map((x) => {
return {
classes: x.classes(),
title: x.attributes('title'),
......@@ -205,7 +205,7 @@ describe('vue_shared/components/awards_list', () => {
const buttons = findAwardButtons();
expect(buttons.length).toBe(7);
expect(buttons.wrappers.every(x => x.classes('disabled'))).toBe(true);
expect(buttons.wrappers.every((x) => x.classes('disabled'))).toBe(true);
});
});
......
......@@ -81,7 +81,7 @@ describe('CI Badge Link Component', () => {
});
it('should render each status badge', () => {
Object.keys(statuses).map(status => {
Object.keys(statuses).map((status) => {
vm = mountComponent(CIBadge, { status: statuses[status] });
expect(vm.$el.getAttribute('href')).toEqual(statuses[status].details_path);
......
......@@ -7,14 +7,14 @@ describe('Commit component', () => {
let props;
let wrapper;
const findIcon = name => {
const icons = wrapper.findAll(GlIcon).filter(c => c.attributes('name') === name);
const findIcon = (name) => {
const icons = wrapper.findAll(GlIcon).filter((c) => c.attributes('name') === name);
return icons.length ? icons.at(0) : icons;
};
const findUserAvatar = () => wrapper.find(UserAvatarLink);
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = shallowMount(CommitComponent, {
propsData,
});
......
......@@ -53,7 +53,7 @@ describe('vue_shared/components/confirm_modal', () => {
const findFormData = () =>
findForm()
.findAll('input')
.wrappers.map(x => ({ name: x.attributes('name'), value: x.attributes('value') }));
.wrappers.map((x) => ({ name: x.attributes('name'), value: x.attributes('value') }));
describe('template', () => {
describe('when modal data is set', () => {
......
......@@ -9,7 +9,7 @@ describe('MarkdownViewer', () => {
let wrapper;
let mock;
const createComponent = props => {
const createComponent = (props) => {
wrapper = mount(MarkdownViewer, {
propsData: {
...props,
......
......@@ -71,7 +71,7 @@ describe('date time picker lib', () => {
'2019-19-23',
'2019-09-23 x',
'2019-09-29 24:24:24',
].forEach(input => {
].forEach((input) => {
it(`throws error for invalid input like ${input}`, () => {
expect(() => inputStringToIsoDate(input)).toThrow();
});
......
......@@ -17,7 +17,7 @@ describe('DateTimePicker', () => {
const applyButtonElement = () => wrapper.find('button.btn-success').element;
const findQuickRangeItems = () => wrapper.findAll('.dropdown-item');
const createComponent = props => {
const createComponent = (props) => {
wrapper = mount(DateTimePicker, {
propsData: {
...props,
......@@ -235,7 +235,7 @@ describe('DateTimePicker', () => {
it('unchecks quick range when text is input is clicked', () => {
const findActiveItems = () =>
findQuickRangeItems().filter(w => w.classes().includes('active'));
findQuickRangeItems().filter((w) => w.classes().includes('active'));
expect(findActiveItems().length).toBe(1);
......
......@@ -156,12 +156,12 @@ describe('DeprecatedModal2', () => {
describe('slots', () => {
const slotContent = 'this should go into the slot';
const modalWithSlot = slot => {
const modalWithSlot = (slot) => {
return Vue.extend({
components: {
DeprecatedModal2,
},
render: h =>
render: (h) =>
h('deprecated-modal-2', [slot ? h('template', { slot }, slotContent) : slotContent]),
});
};
......
......@@ -26,7 +26,7 @@ describe('DiffViewer', () => {
vm.$destroy();
});
it('renders image diff', done => {
it('renders image diff', (done) => {
window.gon = {
relative_url_root: '',
};
......@@ -46,7 +46,7 @@ describe('DiffViewer', () => {
});
});
it('renders fallback download diff display', done => {
it('renders fallback download diff display', (done) => {
createComponent({
...requiredProps,
diffViewerMode: 'added',
......
......@@ -51,7 +51,7 @@ describe('ImageDiffViewer', () => {
wrapper.destroy();
});
it('renders image diff for replaced', done => {
it('renders image diff for replaced', (done) => {
createComponent({ ...allProps });
vm.$nextTick(() => {
......@@ -78,7 +78,7 @@ describe('ImageDiffViewer', () => {
});
});
it('renders image diff for new', done => {
it('renders image diff for new', (done) => {
createComponent({ ...allProps, diffMode: 'new', oldPath: '' });
setImmediate(() => {
......@@ -91,7 +91,7 @@ describe('ImageDiffViewer', () => {
});
});
it('renders image diff for deleted', done => {
it('renders image diff for deleted', (done) => {
createComponent({ ...allProps, diffMode: 'deleted', newPath: '' });
setImmediate(() => {
......@@ -104,7 +104,7 @@ describe('ImageDiffViewer', () => {
});
});
it('renders image diff for renamed', done => {
it('renders image diff for renamed', (done) => {
vm = new Vue({
components: {
imageDiffViewer,
......@@ -139,7 +139,7 @@ describe('ImageDiffViewer', () => {
});
describe('swipeMode', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({ ...requiredProps });
setImmediate(() => {
......@@ -147,7 +147,7 @@ describe('ImageDiffViewer', () => {
});
});
it('switches to Swipe Mode', done => {
it('switches to Swipe Mode', (done) => {
vm.$el.querySelector('.view-modes-menu li:nth-child(2)').click();
vm.$nextTick(() => {
......@@ -158,7 +158,7 @@ describe('ImageDiffViewer', () => {
});
describe('onionSkin', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({ ...requiredProps });
setImmediate(() => {
......@@ -166,7 +166,7 @@ describe('ImageDiffViewer', () => {
});
});
it('switches to Onion Skin Mode', done => {
it('switches to Onion Skin Mode', (done) => {
vm.$el.querySelector('.view-modes-menu li:nth-child(3)').click();
vm.$nextTick(() => {
......@@ -177,7 +177,7 @@ describe('ImageDiffViewer', () => {
});
});
it('has working drag handler', done => {
it('has working drag handler', (done) => {
vm.$el.querySelector('.view-modes-menu li:nth-child(3)').click();
vm.$nextTick(() => {
......
......@@ -43,7 +43,7 @@ describe('DismissibleContainer', () => {
default: 'default slot',
};
it.each(Object.keys(slots))('renders the %s slot', slot => {
it.each(Object.keys(slots))('renders the %s slot', (slot) => {
const slotContent = slots[slot];
wrapper = shallowMount(dismissibleContainer, {
propsData,
......
......@@ -47,7 +47,7 @@ describe('Editor Lite component', () => {
wrapper.destroy();
});
const triggerChangeContent = val => {
const triggerChangeContent = (val) => {
mockInstance.getValue.mockReturnValue(val);
const [cb] = mockInstance.onDidChangeModelContent.mock.calls[0];
......
......@@ -66,7 +66,7 @@ describe('Expand button', () => {
});
describe('on click', () => {
beforeEach(done => {
beforeEach((done) => {
expanderPrependEl().trigger('click');
Vue.nextTick(done);
});
......@@ -85,7 +85,7 @@ describe('Expand button', () => {
});
describe('when short text is provided', () => {
beforeEach(done => {
beforeEach((done) => {
factory({
slots: {
expanded: `<p>${text.expanded}</p>`,
......@@ -110,7 +110,7 @@ describe('Expand button', () => {
});
describe('append button', () => {
beforeEach(done => {
beforeEach((done) => {
expanderPrependEl().trigger('click');
Vue.nextTick(done);
});
......@@ -134,7 +134,7 @@ describe('Expand button', () => {
});
describe('when short text is provided', () => {
beforeEach(done => {
beforeEach((done) => {
factory({
slots: {
expanded: `<p>${text.expanded}</p>`,
......
......@@ -31,7 +31,7 @@ describe('File finder item spec', () => {
});
describe('with entries', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({
files: [
{
......@@ -57,7 +57,7 @@ describe('File finder item spec', () => {
expect(vm.$el.textContent).not.toContain('folder');
});
it('filters entries', done => {
it('filters entries', (done) => {
vm.searchText = 'index';
setImmediate(() => {
......@@ -68,7 +68,7 @@ describe('File finder item spec', () => {
});
});
it('shows clear button when searchText is not empty', done => {
it('shows clear button when searchText is not empty', (done) => {
vm.searchText = 'index';
setImmediate(() => {
......@@ -79,7 +79,7 @@ describe('File finder item spec', () => {
});
});
it('clear button resets searchText', done => {
it('clear button resets searchText', (done) => {
vm.searchText = 'index';
waitForPromises()
......@@ -94,7 +94,7 @@ describe('File finder item spec', () => {
.catch(done.fail);
});
it('clear button focuses search input', done => {
it('clear button focuses search input', (done) => {
jest.spyOn(vm.$refs.searchInput, 'focus').mockImplementation(() => {});
vm.searchText = 'index';
......@@ -111,7 +111,7 @@ describe('File finder item spec', () => {
});
describe('listShowCount', () => {
it('returns 1 when no filtered entries exist', done => {
it('returns 1 when no filtered entries exist', (done) => {
vm.searchText = 'testing 123';
setImmediate(() => {
......@@ -131,7 +131,7 @@ describe('File finder item spec', () => {
expect(vm.listHeight).toBe(55);
});
it('returns 33 when entries dont exist', done => {
it('returns 33 when entries dont exist', (done) => {
vm.searchText = 'testing 123';
setImmediate(() => {
......@@ -143,7 +143,7 @@ describe('File finder item spec', () => {
});
describe('filteredBlobsLength', () => {
it('returns length of filtered blobs', done => {
it('returns length of filtered blobs', (done) => {
vm.searchText = 'index';
setImmediate(() => {
......@@ -156,7 +156,7 @@ describe('File finder item spec', () => {
describe('watches', () => {
describe('searchText', () => {
it('resets focusedIndex when updated', done => {
it('resets focusedIndex when updated', (done) => {
vm.focusedIndex = 1;
vm.searchText = 'test';
......@@ -169,7 +169,7 @@ describe('File finder item spec', () => {
});
describe('visible', () => {
it('returns searchText when false', done => {
it('returns searchText when false', (done) => {
vm.searchText = 'test';
vm.visible = true;
......@@ -206,7 +206,7 @@ describe('File finder item spec', () => {
});
describe('onKeyup', () => {
it('opens file on enter key', done => {
it('opens file on enter key', (done) => {
const event = new CustomEvent('keyup');
event.keyCode = ENTER_KEY_CODE;
......@@ -221,7 +221,7 @@ describe('File finder item spec', () => {
});
});
it('closes file finder on esc key', done => {
it('closes file finder on esc key', (done) => {
const event = new CustomEvent('keyup');
event.keyCode = ESC_KEY_CODE;
......@@ -300,7 +300,7 @@ describe('File finder item spec', () => {
});
describe('keyboard shortcuts', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent();
jest.spyOn(vm, 'toggle').mockImplementation(() => {});
......@@ -308,7 +308,7 @@ describe('File finder item spec', () => {
vm.$nextTick(done);
});
it('calls toggle on `t` key press', done => {
it('calls toggle on `t` key press', (done) => {
Mousetrap.trigger('t');
vm.$nextTick()
......@@ -319,7 +319,7 @@ describe('File finder item spec', () => {
.catch(done.fail);
});
it('calls toggle on `mod+p` key press', done => {
it('calls toggle on `mod+p` key press', (done) => {
Mousetrap.trigger('mod+p');
vm.$nextTick()
......
......@@ -37,7 +37,7 @@ describe('File finder item spec', () => {
expect(vm.$el.classList).toContain('is-focused');
});
it('does not have is-focused class when not focused', done => {
it('does not have is-focused class when not focused', (done) => {
vm.focused = false;
vm.$nextTick(() => {
......@@ -53,7 +53,7 @@ describe('File finder item spec', () => {
expect(vm.$el.querySelector('.diff-changed-stats')).toBe(null);
});
it('renders when a changed file', done => {
it('renders when a changed file', (done) => {
vm.file.changed = true;
vm.$nextTick(() => {
......@@ -63,7 +63,7 @@ describe('File finder item spec', () => {
});
});
it('renders when a temp file', done => {
it('renders when a temp file', (done) => {
vm.file.tempFile = true;
vm.$nextTick(() => {
......@@ -85,7 +85,7 @@ describe('File finder item spec', () => {
describe('path', () => {
let el;
beforeEach(done => {
beforeEach((done) => {
vm.searchText = 'file';
el = vm.$el.querySelector('.diff-changed-file-path');
......@@ -97,7 +97,7 @@ describe('File finder item spec', () => {
expect(el.querySelectorAll('.highlighted').length).toBe(4);
});
it('adds ellipsis to long text', done => {
it('adds ellipsis to long text', (done) => {
vm.file.path = new Array(70)
.fill()
.map((_, i) => `${i}-`)
......@@ -113,7 +113,7 @@ describe('File finder item spec', () => {
describe('name', () => {
let el;
beforeEach(done => {
beforeEach((done) => {
vm.searchText = 'file';
el = vm.$el.querySelector('.diff-changed-file-name');
......@@ -125,7 +125,7 @@ describe('File finder item spec', () => {
expect(el.querySelectorAll('.highlighted').length).toBe(4);
});
it('does not add ellipsis to long text', done => {
it('does not add ellipsis to long text', (done) => {
vm.file.name = new Array(70)
.fill()
.map((_, i) => `${i}-`)
......
......@@ -28,7 +28,7 @@ describe('File Tree component', () => {
const findFileRow = () => wrapper.find(MockFileRow);
const findChildrenTrees = () => wrapper.findAll(FileTree).wrappers.slice(1);
const findChildrenTreeProps = () =>
findChildrenTrees().map(x => ({
findChildrenTrees().map((x) => ({
...x.props(),
...pick(x.attributes(), Object.keys(TEST_EXTA_ARGS)),
}));
......@@ -61,7 +61,7 @@ describe('File Tree component', () => {
describe('file tree', () => {
const createChildren = () => [{ id: 1 }, { id: 2 }];
const createChildrenExpectation = (props = {}) =>
createChildren().map(file => ({
createChildren().map((file) => ({
fileRowComponent: MockFileRow,
file,
...TEST_EXTA_ARGS,
......
......@@ -28,7 +28,7 @@ import {
} from './mock_data';
jest.mock('~/vue_shared/components/filtered_search_bar/filtered_search_utils', () => ({
uniqueTokens: jest.fn().mockImplementation(tokens => tokens),
uniqueTokens: jest.fn().mockImplementation((tokens) => tokens),
stripQuotes: jest.requireActual(
'~/vue_shared/components/filtered_search_bar/filtered_search_utils',
).stripQuotes,
......
export function getFilterParams(tokens, options = {}) {
const { key = 'value', operator = '=', prop = 'title' } = options;
return tokens.map(token => {
return tokens.map((token) => {
return { [key]: token[prop], operator };
});
}
export function getFilterValues(tokens, options = {}) {
const { prop = 'title' } = options;
return tokens.map(token => token[prop]);
return tokens.map((token) => token[prop]);
}
......@@ -17,7 +17,7 @@ describe('GlCountdown', () => {
});
describe('when there is time remaining', () => {
beforeEach(done => {
beforeEach((done) => {
vm = mountComponent(Component, {
endDateString: '2000-01-01T01:02:03Z',
});
......@@ -29,7 +29,7 @@ describe('GlCountdown', () => {
expect(vm.$el.textContent).toContain('01:02:03');
});
it('updates remaining time', done => {
it('updates remaining time', (done) => {
now = '2000-01-01T00:00:01Z';
jest.advanceTimersByTime(1000);
......@@ -43,7 +43,7 @@ describe('GlCountdown', () => {
});
describe('when there is no time remaining', () => {
beforeEach(done => {
beforeEach((done) => {
vm = mountComponent(Component, {
endDateString: '1900-01-01T00:00:00Z',
});
......
......@@ -118,7 +118,7 @@ describe('GlModalVuex', () => {
expect(actions.hide).toHaveBeenCalledTimes(1);
});
it('calls bootstrap show when isVisible changes', done => {
it('calls bootstrap show when isVisible changes', (done) => {
state.isVisible = false;
factory();
......@@ -135,7 +135,7 @@ describe('GlModalVuex', () => {
.catch(done.fail);
});
it('calls bootstrap hide when isVisible changes', done => {
it('calls bootstrap hide when isVisible changes', (done) => {
state.isVisible = true;
factory();
......@@ -154,7 +154,7 @@ describe('GlModalVuex', () => {
it.each(['ok', 'cancel'])(
'passes an "%s" handler to the "modal-footer" slot scope',
handlerName => {
(handlerName) => {
state.isVisible = true;
const modalFooterSlotContent = jest.fn();
......
......@@ -17,13 +17,13 @@ describe('IssuableHeaderWarnings', () => {
const findConfidentialIcon = () => wrapper.find('[data-testid="confidential"]');
const findLockedIcon = () => wrapper.find('[data-testid="locked"]');
const renderTestMessage = renders => (renders ? 'renders' : 'does not render');
const renderTestMessage = (renders) => (renders ? 'renders' : 'does not render');
const setLock = locked => {
const setLock = (locked) => {
store.getters.getNoteableData.discussion_locked = locked;
};
const setConfidential = confidential => {
const setConfidential = (confidential) => {
store.getters.getNoteableData.confidential = confidential;
};
......
......@@ -11,7 +11,7 @@ describe('IssueAssigneesComponent', () => {
let wrapper;
let vm;
const factory = props => {
const factory = (props) => {
wrapper = shallowMount(IssueAssignees, {
propsData: {
assignees: mockAssigneesList,
......@@ -99,11 +99,11 @@ describe('IssueAssigneesComponent', () => {
});
it('renders assignee', () => {
const data = findAvatars().wrappers.map(x => ({
const data = findAvatars().wrappers.map((x) => ({
...x.props(),
}));
const expected = mockAssigneesList.slice(0, TEST_MAX_VISIBLE - 1).map(x =>
const expected = mockAssigneesList.slice(0, TEST_MAX_VISIBLE - 1).map((x) =>
expect.objectContaining({
linkHref: x.web_url,
imgAlt: `Avatar for ${x.name}`,
......
......@@ -19,7 +19,7 @@ describe('IssueMilestoneComponent', () => {
let wrapper;
let vm;
beforeEach(done => {
beforeEach((done) => {
wrapper = createComponent();
({ vm } = wrapper);
......
......@@ -49,7 +49,7 @@ describe('Local Storage Sync', () => {
it.each('foo', 3, true, ['foo', 'bar'], { foo: 'bar' })(
'saves updated value to localStorage',
newValue => {
(newValue) => {
createComponent({
props: {
storageKey,
......
......@@ -6,7 +6,7 @@ describe('Apply Suggestion component', () => {
const propsData = { fileName: 'test.js', disabled: false };
let wrapper;
const createWrapper = props => {
const createWrapper = (props) => {
wrapper = shallowMount(ApplySuggestionComponent, { propsData: { ...propsData, ...props } });
};
......
......@@ -6,7 +6,7 @@ import ToolbarButton from '~/vue_shared/components/markdown/toolbar_button.vue';
describe('Markdown field header component', () => {
let wrapper;
const createWrapper = props => {
const createWrapper = (props) => {
wrapper = shallowMount(HeaderComponent, {
propsData: {
previewMarkdown: false,
......@@ -18,7 +18,7 @@ describe('Markdown field header component', () => {
const findToolbarButtons = () => wrapper.findAll(ToolbarButton);
const findToolbarButtonByProp = (prop, value) =>
findToolbarButtons()
.filter(button => button.props(prop) === value)
.filter((button) => button.props(prop) === value)
.at(0);
beforeEach(() => {
......
......@@ -50,7 +50,7 @@ describe('Suggestion component', () => {
let vm;
let diffTable;
beforeEach(done => {
beforeEach((done) => {
const Component = Vue.extend(SuggestionsComponent);
vm = new Component({
......@@ -86,7 +86,7 @@ describe('Suggestion component', () => {
});
it('generates a diff table that contains contents the suggested lines', () => {
MOCK_DATA.suggestions[0].diff_lines.forEach(line => {
MOCK_DATA.suggestions[0].diff_lines.forEach((line) => {
const text = line.text.substring(1);
expect(diffTable.innerHTML.includes(text)).toBe(true);
......
......@@ -10,7 +10,7 @@ describe('toolbar_button', () => {
tag: 'test tag',
};
const createComponent = propUpdates => {
const createComponent = (propUpdates) => {
wrapper = shallowMount(ToolbarButton, {
propsData: {
...defaultProps,
......
......@@ -10,7 +10,7 @@ describe('Issue Warning Component', () => {
const findConfidentialBlock = (w = wrapper) => w.find({ ref: 'confidential' });
const findLockedAndConfidentialBlock = (w = wrapper) => w.find({ ref: 'lockedAndConfidential' });
const createComponent = props =>
const createComponent = (props) =>
shallowMount(NoteableWarning, {
propsData: {
...props,
......
......@@ -29,7 +29,7 @@ describe('Ordered Layout', () => {
const verifyOrder = () =>
wrapper
.findAll('footer,header')
.wrappers.map(x => (x.element.tagName === 'FOOTER' ? 'footer' : 'header'));
.wrappers.map((x) => (x.element.tagName === 'FOOTER' ? 'footer' : 'header'));
const createComponent = (props = {}) => {
wrapper = mount(TestComponent, {
......
......@@ -49,7 +49,7 @@ describe('Pagination links component', () => {
});
it('should provide translated text to GitLab UI pagination', () => {
Object.entries(translations).forEach(entry => {
Object.entries(translations).forEach((entry) => {
expect(glPagination.vm[entry[0]]).toBe(entry[1]);
});
});
......
......@@ -19,7 +19,7 @@ describe('ProjectAvatarDefault component', () => {
vm.$destroy();
});
it('renders identicon if project has no avatar_url', done => {
it('renders identicon if project has no avatar_url', (done) => {
const expectedText = getFirstCharacterCapitalized(projectData.name);
vm.project = {
......@@ -38,7 +38,7 @@ describe('ProjectAvatarDefault component', () => {
.catch(done.fail);
});
it('renders avatar image if project has avatar_url', done => {
it('renders avatar image if project has avatar_url', (done) => {
const avatarUrl = `${TEST_HOST}/images/home/nasa.svg`;
vm.project = {
......
......@@ -8,7 +8,7 @@ describe('DetailsRow', () => {
const findIcon = () => wrapper.find(GlIcon);
const findDefaultSlot = () => wrapper.find('[data-testid="default-slot"]');
const mountComponent = props => {
const mountComponent = (props) => {
wrapper = shallowMount(component, {
propsData: {
icon: 'clock',
......
......@@ -11,7 +11,7 @@ describe('list item', () => {
const findRightPrimarySlot = () => wrapper.find('[data-testid="right-primary"]');
const findRightSecondarySlot = () => wrapper.find('[data-testid="right-secondary"]');
const findRightActionSlot = () => wrapper.find('[data-testid="right-action"]');
const findDetailsSlot = name => wrapper.find(`[data-testid="${name}"]`);
const findDetailsSlot = (name) => wrapper.find(`[data-testid="${name}"]`);
const findToggleDetailsButton = () => wrapper.find(GlButton);
const mountComponent = (propsData, slots) => {
......@@ -74,14 +74,14 @@ describe('list item', () => {
findToggleDetailsButton().vm.$emit('click');
await wrapper.vm.$nextTick();
slotNames.forEach(name => {
slotNames.forEach((name) => {
expect(findDetailsSlot(name).exists()).toBe(true);
});
});
it('are not visible when details are not shown', () => {
mountComponent({}, slotMocks);
slotNames.forEach(name => {
slotNames.forEach((name) => {
expect(findDetailsSlot(name).exists()).toBe(false);
});
});
......
......@@ -25,7 +25,7 @@ describe('Metadata Item', () => {
const findText = () => wrapper.find('[data-testid="metadata-item-text"]');
const findTooltipOnTruncate = (w = wrapper) => w.find(TooltipOnTruncate);
describe.each(['xs', 's', 'm', 'l', 'xl'])('size class', size => {
describe.each(['xs', 's', 'm', 'l', 'xl'])('size class', (size) => {
const className = `mw-${size}`;
it(`${size} is assigned correctly to text`, () => {
......
......@@ -9,7 +9,7 @@ describe('title area', () => {
const findSubHeaderSlot = () => wrapper.find('[data-testid="sub-header"]');
const findRightActionsSlot = () => wrapper.find('[data-testid="right-actions"]');
const findMetadataSlot = name => wrapper.find(`[data-testid="${name}"]`);
const findMetadataSlot = (name) => wrapper.find(`[data-testid="${name}"]`);
const findTitle = () => wrapper.find('[data-testid="title"]');
const findAvatar = () => wrapper.find(GlAvatar);
const findInfoMessages = () => wrapper.findAll('[data-testid="info-message"]');
......@@ -97,7 +97,7 @@ describe('title area', () => {
mountComponent({ slots: slotMocks });
await wrapper.vm.$nextTick();
slotNames.forEach(name => {
slotNames.forEach((name) => {
expect(findMetadataSlot(name).exists()).toBe(true);
});
});
......@@ -106,7 +106,7 @@ describe('title area', () => {
mountComponent({ slots: slotMocks, propsData: { title: 'foo', metadataLoading: true } });
await wrapper.vm.$nextTick();
slotNames.forEach(name => {
slotNames.forEach((name) => {
expect(findMetadataSlot(name).exists()).toBe(false);
});
});
......
......@@ -20,7 +20,7 @@ describe('Editor Service', () => {
let mockInstance;
let event;
let handler;
const parseHtml = str => {
const parseHtml = (str) => {
const wrapper = document.createElement('div');
wrapper.innerHTML = str;
return wrapper.firstChild;
......
......@@ -10,7 +10,7 @@ describe('Upload Image Tab', () => {
afterEach(() => wrapper.destroy());
const triggerInputEvent = size => {
const triggerInputEvent = (size) => {
const file = { size, name: 'file-name.png' };
const mockEvent = new Event('input');
......
......@@ -8,7 +8,7 @@ describe('Insert Video Modal', () => {
const findModal = () => wrapper.find(GlModal);
const findUrlInput = () => wrapper.find({ ref: 'urlInput' });
const triggerInsertVideo = url => {
const triggerInsertVideo = (url) => {
const preventDefault = jest.fn();
findUrlInput().vm.$emit('input', url);
findModal().vm.$emit('primary', { preventDefault });
......
......@@ -8,9 +8,9 @@ describe('rich_content_editor/services/html_to_markdown_renderer', () => {
beforeEach(() => {
baseRenderer = {
trim: jest.fn(input => `trimmed ${input}`),
getSpaceCollapsedText: jest.fn(input => `space collapsed ${input}`),
getSpaceControlled: jest.fn(input => `space controlled ${input}`),
trim: jest.fn((input) => `trimmed ${input}`),
getSpaceCollapsedText: jest.fn((input) => `space collapsed ${input}`),
getSpaceControlled: jest.fn((input) => `space controlled ${input}`),
convert: jest.fn(),
};
......
// Node spec helpers
export const buildMockTextNode = literal => ({ literal, type: 'text' });
export const buildMockTextNode = (literal) => ({ literal, type: 'text' });
export const normalTextNode = buildMockTextNode('This is just normal text.');
// Token spec helpers
const buildMockUneditableOpenToken = type => {
const buildMockUneditableOpenToken = (type) => {
return {
type: 'openTag',
tagName: type,
......@@ -17,7 +17,7 @@ const buildMockUneditableOpenToken = type => {
};
};
const buildMockTextToken = content => {
const buildMockTextToken = (content) => {
return {
type: 'text',
tagName: null,
......@@ -25,7 +25,7 @@ const buildMockTextToken = content => {
};
};
const buildMockUneditableCloseToken = type => ({ type: 'closeTag', tagName: type });
const buildMockUneditableCloseToken = (type) => ({ type: 'closeTag', tagName: type });
export const originToken = buildMockTextToken('{:.no_toc .hidden-md .hidden-lg}');
const uneditableOpenToken = buildMockUneditableOpenToken('div');
......
......@@ -36,7 +36,7 @@ describe('Render Identifier Instance Text renderer', () => {
`(
'should return inline editable, uneditable, and editable tokens in sequence',
({ start, middle, end }) => {
const buildMockTextToken = content => ({ type: 'text', tagName: null, content });
const buildMockTextToken = (content) => ({ type: 'text', tagName: null, content });
const startToken = buildMockTextToken(start);
const middleToken = buildMockTextToken(middle);
......
......@@ -2,7 +2,7 @@ import renderer from '~/vue_shared/components/rich_content_editor/services/rende
import { buildMockTextNode } from './mock_data';
const buildMockParagraphNode = literal => {
const buildMockParagraphNode = (literal) => {
return {
firstChild: buildMockTextNode(literal),
type: 'paragraph',
......
......@@ -9,7 +9,7 @@ describe('Toolbar Item', () => {
const findIcon = () => wrapper.find(GlIcon);
const findButton = () => wrapper.find('button');
const buildWrapper = propsData => {
const buildWrapper = (propsData) => {
wrapper = shallowMount(ToolbarItem, {
propsData,
directives: {
......
......@@ -8,7 +8,7 @@ const discoverProjectSecurityPath = '/discoverProjectSecurityPath';
describe('HelpIcon component', () => {
let wrapper;
const createWrapper = props => {
const createWrapper = (props) => {
wrapper = shallowMount(HelpIcon, {
propsData: {
helpPath,
......
......@@ -6,7 +6,7 @@ import { groupedTextBuilder } from '~/vue_shared/security_reports/store/utils';
describe('SecuritySummary component', () => {
let wrapper;
const createWrapper = message => {
const createWrapper = (message) => {
wrapper = shallowMount(SecuritySummary, {
propsData: { message },
stubs: {
......@@ -26,7 +26,7 @@ describe('SecuritySummary component', () => {
groupedTextBuilder({ reportType: 'Security scanning', critical: 1, high: 0, total: 1 }),
groupedTextBuilder({ reportType: 'Security scanning', critical: 0, high: 1, total: 1 }),
groupedTextBuilder({ reportType: 'Security scanning', critical: 1, high: 2, total: 3 }),
])('given the message %p', message => {
])('given the message %p', (message) => {
beforeEach(() => {
createWrapper(message);
});
......
......@@ -12,7 +12,7 @@ describe('collapsedGroupedDatePicker', () => {
});
describe('toggleCollapse events', () => {
beforeEach(done => {
beforeEach((done) => {
jest.spyOn(vm, 'toggleSidebar').mockImplementation(() => {});
vm.minDate = new Date('07/17/2016');
Vue.nextTick(done);
......@@ -26,7 +26,7 @@ describe('collapsedGroupedDatePicker', () => {
});
describe('minDate and maxDate', () => {
beforeEach(done => {
beforeEach((done) => {
vm.minDate = new Date('07/17/2016');
vm.maxDate = new Date('07/17/2017');
Vue.nextTick(done);
......@@ -42,7 +42,7 @@ describe('collapsedGroupedDatePicker', () => {
});
describe('minDate', () => {
beforeEach(done => {
beforeEach((done) => {
vm.minDate = new Date('07/17/2016');
Vue.nextTick(done);
});
......@@ -56,7 +56,7 @@ describe('collapsedGroupedDatePicker', () => {
});
describe('maxDate', () => {
beforeEach(done => {
beforeEach((done) => {
vm.maxDate = new Date('07/17/2017');
Vue.nextTick(done);
});
......
......@@ -15,7 +15,7 @@ describe('BaseComponent', () => {
let wrapper;
let vm;
beforeEach(done => {
beforeEach((done) => {
wrapper = createComponent();
({ vm } = wrapper);
......
......@@ -5,7 +5,7 @@ import dropdownCreateLabelComponent from '~/vue_shared/components/sidebar/labels
import { mockSuggestedColors } from './mock_data';
const createComponent = headerTitle => {
const createComponent = (headerTitle) => {
const Component = Vue.extend(dropdownCreateLabelComponent);
return mountComponent(Component, {
......
......@@ -37,7 +37,7 @@ describe('DropdownValueCollapsedComponent', () => {
const labels = mockLabels.concat(mockLabels);
const vmMoreLabels = createComponent(labels);
const expectedText = labels.map(label => label.title).join(', ');
const expectedText = labels.map((label) => label.title).join(', ');
expect(vmMoreLabels.labelsList).toBe(expectedText);
vmMoreLabels.$destroy();
......@@ -53,7 +53,7 @@ describe('DropdownValueCollapsedComponent', () => {
const expectedText = `${mockMoreLabels
.slice(0, 5)
.map(label => label.title)
.map((label) => label.title)
.join(', ')}, and ${mockMoreLabels.length - 5} more`;
expect(vmMoreLabels.labelsList).toBe(expectedText);
......@@ -61,7 +61,7 @@ describe('DropdownValueCollapsedComponent', () => {
});
it('returns first label name when `labels` prop has only one item present', () => {
const text = mockLabels.map(label => label.title).join(', ');
const text = mockLabels.map((label) => label.title).join(', ');
expect(vm.labelsList).toBe(text);
});
......
......@@ -24,7 +24,7 @@ const createComponent = (initialState = mockConfig) => {
describe('DropdownContentsCreateView', () => {
let wrapper;
const colors = Object.keys(mockSuggestedColors).map(color => ({
const colors = Object.keys(mockSuggestedColors).map((color) => ({
[color]: mockSuggestedColors[color],
}));
......
......@@ -19,7 +19,7 @@ describe('LabelsSelect Actions', () => {
});
describe('setInitialState', () => {
it('sets initial store state', done => {
it('sets initial store state', (done) => {
testAction(
actions.setInitialState,
mockInitialState,
......@@ -32,7 +32,7 @@ describe('LabelsSelect Actions', () => {
});
describe('toggleDropdownButton', () => {
it('toggles dropdown button', done => {
it('toggles dropdown button', (done) => {
testAction(
actions.toggleDropdownButton,
{},
......@@ -45,7 +45,7 @@ describe('LabelsSelect Actions', () => {
});
describe('toggleDropdownContents', () => {
it('toggles dropdown contents', done => {
it('toggles dropdown contents', (done) => {
testAction(
actions.toggleDropdownContents,
{},
......@@ -58,7 +58,7 @@ describe('LabelsSelect Actions', () => {
});
describe('toggleDropdownContentsCreateView', () => {
it('toggles dropdown create view', done => {
it('toggles dropdown create view', (done) => {
testAction(
actions.toggleDropdownContentsCreateView,
{},
......@@ -71,13 +71,13 @@ describe('LabelsSelect Actions', () => {
});
describe('requestLabels', () => {
it('sets value of `state.labelsFetchInProgress` to `true`', done => {
it('sets value of `state.labelsFetchInProgress` to `true`', (done) => {
testAction(actions.requestLabels, {}, state, [{ type: types.REQUEST_LABELS }], [], done);
});
});
describe('receiveLabelsSuccess', () => {
it('sets provided labels to `state.labels`', done => {
it('sets provided labels to `state.labels`', (done) => {
const labels = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }];
testAction(
......@@ -96,7 +96,7 @@ describe('LabelsSelect Actions', () => {
setFixtures('<div class="flash-container"></div>');
});
it('sets value `state.labelsFetchInProgress` to `false`', done => {
it('sets value `state.labelsFetchInProgress` to `false`', (done) => {
testAction(
actions.receiveLabelsFailure,
{},
......@@ -129,7 +129,7 @@ describe('LabelsSelect Actions', () => {
});
describe('on success', () => {
it('dispatches `requestLabels` & `receiveLabelsSuccess` actions', done => {
it('dispatches `requestLabels` & `receiveLabelsSuccess` actions', (done) => {
const labels = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }];
mock.onGet(/labels.json/).replyOnce(200, labels);
......@@ -145,7 +145,7 @@ describe('LabelsSelect Actions', () => {
});
describe('on failure', () => {
it('dispatches `requestLabels` & `receiveLabelsFailure` actions', done => {
it('dispatches `requestLabels` & `receiveLabelsFailure` actions', (done) => {
mock.onGet(/labels.json/).replyOnce(500, {});
testAction(
......@@ -161,7 +161,7 @@ describe('LabelsSelect Actions', () => {
});
describe('requestCreateLabel', () => {
it('sets value `state.labelCreateInProgress` to `true`', done => {
it('sets value `state.labelCreateInProgress` to `true`', (done) => {
testAction(
actions.requestCreateLabel,
{},
......@@ -174,7 +174,7 @@ describe('LabelsSelect Actions', () => {
});
describe('receiveCreateLabelSuccess', () => {
it('sets value `state.labelCreateInProgress` to `false`', done => {
it('sets value `state.labelCreateInProgress` to `false`', (done) => {
testAction(
actions.receiveCreateLabelSuccess,
{},
......@@ -191,7 +191,7 @@ describe('LabelsSelect Actions', () => {
setFixtures('<div class="flash-container"></div>');
});
it('sets value `state.labelCreateInProgress` to `false`', done => {
it('sets value `state.labelCreateInProgress` to `false`', (done) => {
testAction(
actions.receiveCreateLabelFailure,
{},
......@@ -224,7 +224,7 @@ describe('LabelsSelect Actions', () => {
});
describe('on success', () => {
it('dispatches `requestCreateLabel`, `receiveCreateLabelSuccess` & `toggleDropdownContentsCreateView` actions', done => {
it('dispatches `requestCreateLabel`, `receiveCreateLabelSuccess` & `toggleDropdownContentsCreateView` actions', (done) => {
const label = { id: 1 };
mock.onPost(/labels.json/).replyOnce(200, label);
......@@ -244,7 +244,7 @@ describe('LabelsSelect Actions', () => {
});
describe('on failure', () => {
it('dispatches `requestCreateLabel` & `receiveCreateLabelFailure` actions', done => {
it('dispatches `requestCreateLabel` & `receiveCreateLabelFailure` actions', (done) => {
mock.onPost(/labels.json/).replyOnce(500, {});
testAction(
......@@ -260,7 +260,7 @@ describe('LabelsSelect Actions', () => {
});
describe('updateSelectedLabels', () => {
it('updates `state.labels` based on provided `labels` param', done => {
it('updates `state.labels` based on provided `labels` param', (done) => {
const labels = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }];
testAction(
......
......@@ -93,14 +93,14 @@ describe('LabelsSelect Mutations', () => {
});
it('sets provided `labels` to `state.labels` along with `set` prop based on `state.selectedLabels`', () => {
const selectedLabelIds = selectedLabels.map(label => label.id);
const selectedLabelIds = selectedLabels.map((label) => label.id);
const state = {
selectedLabels,
labelsFetchInProgress: true,
};
mutations[types.RECEIVE_SET_LABELS_SUCCESS](state, labels);
state.labels.forEach(label => {
state.labels.forEach((label) => {
if (selectedLabelIds.includes(label.id)) {
expect(label.set).toBe(true);
}
......@@ -162,7 +162,7 @@ describe('LabelsSelect Mutations', () => {
};
mutations[types.UPDATE_SELECTED_LABELS](state, { labels: [{ id: 2 }] });
state.labels.forEach(label => {
state.labels.forEach((label) => {
if (updatedLabelIds.includes(label.id)) {
expect(label.touched).toBe(true);
expect(label.set).toBe(true);
......
......@@ -10,14 +10,14 @@ describe('SlotSwitch', () => {
let wrapper;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = shallowMount(SlotSwitch, {
propsData,
slots,
});
};
const getChildrenHtml = () => wrapper.findAll('* *').wrappers.map(c => c.html());
const getChildrenHtml = () => wrapper.findAll('* *').wrappers.map((c) => c.html());
afterEach(() => {
if (wrapper) {
......
......@@ -19,7 +19,7 @@ const mockActionItems = [
describe('SplitButton', () => {
let wrapper;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = shallowMount(SplitButton, {
propsData,
});
......@@ -27,7 +27,7 @@ describe('SplitButton', () => {
const findDropdown = () => wrapper.find(GlDropdown);
const findDropdownItem = (index = 0) => findDropdown().findAll(GlDropdownItem).at(index);
const selectItem = index => {
const selectItem = (index) => {
findDropdownItem(index).vm.$emit('click');
return wrapper.vm.$nextTick();
......@@ -84,7 +84,7 @@ describe('SplitButton', () => {
const addChangeEventHandler = () => {
changeEventHandler = jest.fn();
wrapper.vm.$once('change', item => changeEventHandler(item));
wrapper.vm.$once('change', (item) => changeEventHandler(item));
};
it('defaults to first actionItems event', () => {
......
......@@ -6,7 +6,7 @@ describe('Pagination component', () => {
let wrapper;
let spy;
const mountComponent = props => {
const mountComponent = (props) => {
wrapper = shallowMount(TablePagination, {
propsData: props,
});
......
......@@ -10,7 +10,7 @@ describe('Tab component', () => {
vm = mountComponent(Component);
});
it('sets localActive to equal active', done => {
it('sets localActive to equal active', (done) => {
vm.active = true;
vm.$nextTick(() => {
......@@ -20,7 +20,7 @@ describe('Tab component', () => {
});
});
it('sets active class', done => {
it('sets active class', (done) => {
vm.active = true;
vm.$nextTick(() => {
......
......@@ -139,7 +139,7 @@ describe('TooltipOnTruncate component', () => {
createComponent({
propsData: {
title: DUMMY_TEXT,
truncateTarget: el => el.childNodes[1],
truncateTarget: (el) => el.childNodes[1],
},
slots: {
default: [createChildElement(), createChildElement()],
......
......@@ -20,7 +20,7 @@ describe('User Avatar Link Component', () => {
username: 'username',
};
const createWrapper = props => {
const createWrapper = (props) => {
wrapper = shallowMount(UserAvatarLink, {
propsData: {
...defaultProps,
......
......@@ -9,13 +9,13 @@ const TEST_BREAKPOINT = 5;
const TEST_EMPTY_MESSAGE = 'Lorem ipsum empty';
const DEFAULT_EMPTY_MESSAGE = 'None';
const createUser = id => ({
const createUser = (id) => ({
id,
name: 'Lorem',
web_url: `${TEST_HOST}/${id}`,
avatar_url: `${TEST_HOST}/${id}/avatar`,
});
const createList = n =>
const createList = (n) =>
Array(n)
.fill(1)
.map((x, id) => createUser(id));
......@@ -79,10 +79,10 @@ describe('UserAvatarList', () => {
factory({ propsData: { items } });
const links = wrapper.findAll(UserAvatarLink);
const linkProps = links.wrappers.map(x => x.props());
const linkProps = links.wrappers.map((x) => x.props());
expect(linkProps).toEqual(
items.map(x =>
items.map((x) =>
expect.objectContaining({
linkHref: x.web_url,
imgSrc: x.avatar_url,
......
......@@ -33,7 +33,7 @@ describe('User Popover Component', () => {
wrapper.destroy();
});
const findByTestId = testid => wrapper.find(`[data-testid="${testid}"]`);
const findByTestId = (testid) => wrapper.find(`[data-testid="${testid}"]`);
const findUserStatus = () => wrapper.find('.js-user-status');
const findTarget = () => document.querySelector('.js-user-link');
const findAvailabilityStatus = () => wrapper.find(UserAvailabilityStatus);
......@@ -148,7 +148,7 @@ describe('User Popover Component', () => {
createWrapper({ user });
expect(
wrapper.findAll(GlIcon).filter(icon => icon.props('name') === 'profile').length,
wrapper.findAll(GlIcon).filter((icon) => icon.props('name') === 'profile').length,
).toEqual(1);
});
......@@ -160,9 +160,9 @@ describe('User Popover Component', () => {
createWrapper({ user });
expect(wrapper.findAll(GlIcon).filter(icon => icon.props('name') === 'work').length).toEqual(
1,
);
expect(
wrapper.findAll(GlIcon).filter((icon) => icon.props('name') === 'work').length,
).toEqual(1);
});
});
......
......@@ -50,7 +50,7 @@ describe('validation directive', () => {
describe.each([true, false])(
'with fields untouched and "showValidation" set to "%s"',
showValidation => {
(showValidation) => {
beforeEach(() => {
createComponent({ showValidation });
});
......@@ -78,7 +78,7 @@ describe('validation directive', () => {
`(
'with input-attributes set to $inputAttributes',
({ inputAttributes, validValue, invalidValue }) => {
const setValueAndTriggerValidation = value => {
const setValueAndTriggerValidation = (value) => {
const input = findInput();
input.setValue(value);
input.trigger('blur');
......
......@@ -6,7 +6,7 @@ describe('SecurityReportDownloadDropdown component', () => {
let wrapper;
let artifacts;
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(SecurityReportDownloadDropdown, {
propsData: { ...props },
});
......
......@@ -42,7 +42,7 @@ describe('Security reports app', () => {
discoverProjectSecurityPath: '/discoverProjectSecurityPath',
};
const createComponent = options => {
const createComponent = (options) => {
wrapper = mount(
SecurityReportsApp,
merge(
......@@ -61,7 +61,7 @@ describe('Security reports app', () => {
const pendingHandler = () => new Promise(() => {});
const successHandler = () => Promise.resolve({ data: securityReportDownloadPathsQueryResponse });
const failureHandler = () => Promise.resolve({ errors: [{ message: 'some error' }] });
const createMockApolloProvider = handler => {
const createMockApolloProvider = (handler) => {
localVue.use(VueApollo);
const requestHandlers = [[securityReportDownloadPathsQuery, handler]];
......@@ -74,7 +74,7 @@ describe('Security reports app', () => {
const findDownloadDropdown = () => wrapper.find(SecurityReportDownloadDropdown);
const findPipelinesTabAnchor = () => wrapper.find('[data-testid="show-pipelines"]');
const findHelpIconComponent = () => wrapper.find(HelpIcon);
const setupMockJobArtifact = reportType => {
const setupMockJobArtifact = (reportType) => {
jest
.spyOn(Api, 'pipelineJobs')
.mockResolvedValue({ data: [{ artifacts: [{ file_type: reportType }] }] });
......@@ -93,8 +93,8 @@ describe('Security reports app', () => {
describe.each([false, true])(
'given the coreSecurityMrWidgetCounts feature flag is %p',
coreSecurityMrWidgetCounts => {
const createComponentWithFlag = options =>
(coreSecurityMrWidgetCounts) => {
const createComponentWithFlag = (options) =>
createComponent(
merge(
{
......@@ -108,7 +108,7 @@ describe('Security reports app', () => {
),
);
describe.each(SecurityReportsApp.reportTypes)('given a report type %p', reportType => {
describe.each(SecurityReportsApp.reportTypes)('given a report type %p', (reportType) => {
beforeEach(() => {
window.mrTabs = { tabShown: jest.fn() };
setupMockJobArtifact(reportType);
......@@ -245,7 +245,7 @@ describe('Security reports app', () => {
describe('given the coreSecurityMrWidgetCounts feature flag is enabled', () => {
let mock;
const createComponentWithFlagEnabled = options =>
const createComponentWithFlagEnabled = (options) =>
createComponent(
merge(options, {
provide: {
......@@ -350,7 +350,7 @@ describe('Security reports app', () => {
});
describe('given coreSecurityMrWidgetDownloads feature flag is enabled', () => {
const createComponentWithFlagEnabled = options =>
const createComponentWithFlagEnabled = (options) =>
createComponent(
merge(options, {
provide: {
......
......@@ -13,7 +13,7 @@ import {
} from '~/vue_shared/security_reports/store/getters';
import { CRITICAL, HIGH, LOW } from '~/vulnerabilities/constants';
const generateVuln = severity => ({ severity });
const generateVuln = (severity) => ({ severity });
describe('Security reports getters', () => {
let state;
......
......@@ -26,7 +26,7 @@ describe('sast report actions', () => {
});
describe('setDiffEndpoint', () => {
it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, done => {
it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, (done) => {
testAction(
actions.setDiffEndpoint,
diffEndpoint,
......@@ -44,13 +44,13 @@ describe('sast report actions', () => {
});
describe('requestDiff', () => {
it(`should commit ${types.REQUEST_DIFF}`, done => {
it(`should commit ${types.REQUEST_DIFF}`, (done) => {
testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done);
});
});
describe('receiveDiffSuccess', () => {
it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, done => {
it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, (done) => {
testAction(
actions.receiveDiffSuccess,
reports,
......@@ -68,7 +68,7 @@ describe('sast report actions', () => {
});
describe('receiveDiffError', () => {
it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, done => {
it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, (done) => {
testAction(
actions.receiveDiffError,
error,
......@@ -107,7 +107,7 @@ describe('sast report actions', () => {
.replyOnce(200, reports.enrichData);
});
it('should dispatch the `receiveDiffSuccess` action', done => {
it('should dispatch the `receiveDiffSuccess` action', (done) => {
const { diff, enrichData } = reports;
testAction(
actions.fetchDiff,
......@@ -135,7 +135,7 @@ describe('sast report actions', () => {
mock.onGet(diffEndpoint).replyOnce(200, reports.diff);
});
it('should dispatch the `receiveDiffSuccess` action with empty enrich data', done => {
it('should dispatch the `receiveDiffSuccess` action with empty enrich data', (done) => {
const { diff } = reports;
const enrichData = [];
testAction(
......@@ -167,7 +167,7 @@ describe('sast report actions', () => {
.replyOnce(404);
});
it('should dispatch the `receiveError` action', done => {
it('should dispatch the `receiveError` action', (done) => {
testAction(
actions.fetchDiff,
{},
......@@ -188,7 +188,7 @@ describe('sast report actions', () => {
.replyOnce(200, reports.enrichData);
});
it('should dispatch the `receiveDiffError` action', done => {
it('should dispatch the `receiveDiffError` action', (done) => {
testAction(
actions.fetchDiff,
{},
......
......@@ -26,7 +26,7 @@ describe('secret detection report actions', () => {
});
describe('setDiffEndpoint', () => {
it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, done => {
it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, (done) => {
testAction(
actions.setDiffEndpoint,
diffEndpoint,
......@@ -44,13 +44,13 @@ describe('secret detection report actions', () => {
});
describe('requestDiff', () => {
it(`should commit ${types.REQUEST_DIFF}`, done => {
it(`should commit ${types.REQUEST_DIFF}`, (done) => {
testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done);
});
});
describe('receiveDiffSuccess', () => {
it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, done => {
it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, (done) => {
testAction(
actions.receiveDiffSuccess,
reports,
......@@ -68,7 +68,7 @@ describe('secret detection report actions', () => {
});
describe('receiveDiffError', () => {
it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, done => {
it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, (done) => {
testAction(
actions.receiveDiffError,
error,
......@@ -107,7 +107,7 @@ describe('secret detection report actions', () => {
.replyOnce(200, reports.enrichData);
});
it('should dispatch the `receiveDiffSuccess` action', done => {
it('should dispatch the `receiveDiffSuccess` action', (done) => {
const { diff, enrichData } = reports;
testAction(
actions.fetchDiff,
......@@ -135,7 +135,7 @@ describe('secret detection report actions', () => {
mock.onGet(diffEndpoint).replyOnce(200, reports.diff);
});
it('should dispatch the `receiveDiffSuccess` action with empty enrich data', done => {
it('should dispatch the `receiveDiffSuccess` action with empty enrich data', (done) => {
const { diff } = reports;
const enrichData = [];
testAction(
......@@ -167,7 +167,7 @@ describe('secret detection report actions', () => {
.replyOnce(404);
});
it('should dispatch the `receiveDiffError` action', done => {
it('should dispatch the `receiveDiffError` action', (done) => {
testAction(
actions.fetchDiff,
{},
......@@ -188,7 +188,7 @@ describe('secret detection report actions', () => {
.replyOnce(200, reports.enrichData);
});
it('should dispatch the `receiveDiffError` action', done => {
it('should dispatch the `receiveDiffError` action', (done) => {
testAction(
actions.fetchDiff,
{},
......
......@@ -4,7 +4,7 @@ import * as actions from '~/vuex_shared/modules/modal/actions';
describe('Vuex ModalModule actions', () => {
describe('open', () => {
it('works', done => {
it('works', (done) => {
const data = { id: 7 };
testAction(actions.open, data, {}, [{ type: types.OPEN, payload: data }], [], done);
......@@ -12,19 +12,19 @@ describe('Vuex ModalModule actions', () => {
});
describe('close', () => {
it('works', done => {
it('works', (done) => {
testAction(actions.close, null, {}, [{ type: types.CLOSE }], [], done);
});
});
describe('show', () => {
it('works', done => {
it('works', (done) => {
testAction(actions.show, null, {}, [{ type: types.SHOW }], [], done);
});
});
describe('hide', () => {
it('works', done => {
it('works', (done) => {
testAction(actions.hide, null, {}, [{ type: types.HIDE }], [], done);
});
});
......
......@@ -103,7 +103,7 @@ describe('App', () => {
expect(actions.closeDrawer).toHaveBeenCalled();
});
it.each([true, false])('passes open property', async openState => {
it.each([true, false])('passes open property', async (openState) => {
wrapper.vm.$store.state.open = openState;
await wrapper.vm.$nextTick();
......@@ -183,7 +183,7 @@ describe('App', () => {
const clickSecondTab = async () => {
const secondTab = wrapper.findAll('.nav-link').at(1);
await secondTab.trigger('click');
await new Promise(resolve => requestAnimationFrame(resolve));
await new Promise((resolve) => requestAnimationFrame(resolve));
};
beforeEach(() => {
......
......@@ -5,7 +5,7 @@ import { setHTMLFixture } from './helpers/fixtures';
describe('Wikis', () => {
describe('setting the commit message when the title changes', () => {
const editFormHtmlFixture = args => `<form class="wiki-form ${
const editFormHtmlFixture = (args) => `<form class="wiki-form ${
args.newPage ? 'js-new-wiki-page' : ''
}">
<input type="text" id="wiki_title" value="My title" />
......
......@@ -66,7 +66,7 @@ describe('WebIDE', () => {
// Assert that +test is the only open tab
const tabs = Array.from(document.querySelectorAll('.multi-file-tab'));
expect(tabs.map(x => x.textContent.trim())).toEqual(['+test']);
expect(tabs.map((x) => x.textContent.trim())).toEqual(['+test']);
});
describe('editor info', () => {
......
......@@ -10,9 +10,9 @@ const createFactoryWithDefault = (fn, defaultValue) => () => {
};
const factory = {
json: fn => createFactoryWithDefault(fn, { error: 'fixture not found' }),
text: fn => createFactoryWithDefault(fn, 'Hello world\nHow are you today?\n'),
binary: fn => createFactoryWithDefault(fn, ''),
json: (fn) => createFactoryWithDefault(fn, { error: 'fixture not found' }),
text: (fn) => createFactoryWithDefault(fn, 'Hello world\nHow are you today?\n'),
binary: (fn) => createFactoryWithDefault(fn, ''),
};
export const getProject = factory.json(() => require('test_fixtures/api/projects/get.json'));
......
......@@ -26,7 +26,7 @@ export const createMockServerOptions = () => ({
},
seeds(schema) {
schema.db.loadData({
files: getRepositoryFiles().map(path => ({ path })),
files: getRepositoryFiles().map((path) => ({ path })),
projects: [getProject(), getEmptyProject()],
branches: [getBranch()],
mergeRequests: getMergeRequests(),
......
export default server => {
['get', 'post', 'put', 'delete', 'patch'].forEach(method => {
export default (server) => {
['get', 'post', 'put', 'delete', 'patch'].forEach((method) => {
server[method]('*', () => {
return new Response(404);
});
......
import { getPipelinesEmptyResponse } from 'test_helpers/fixtures';
export default server => {
export default (server) => {
server.get('*/commit/:id/pipelines', () => {
return getPipelinesEmptyResponse();
});
......
import { graphqlQuery } from '../graphql';
export default server => {
export default (server) => {
server.post('/api/graphql', (schema, request) => {
const batches = JSON.parse(request.requestBody);
......
/* eslint-disable global-require */
export default server => {
export default (server) => {
[
require('./graphql'),
require('./projects'),
......
import { withKeys } from 'test_helpers/utils/obj';
export default server => {
export default (server) => {
server.get('/api/v4/projects/:id', (schema, request) => {
const { id } = request.params;
......
import { createNewCommit, createCommitIdGenerator } from 'test_helpers/factories';
export default server => {
export default (server) => {
const commitIdGenerator = createCommitIdGenerator();
server.get('/api/v4/projects/:id/repository/branches', schema => {
server.get('/api/v4/projects/:id/repository/branches', (schema) => {
return schema.db.branches;
});
......@@ -15,7 +15,7 @@ export default server => {
return branch.attrs;
});
server.get('*/-/files/:id', schema => {
server.get('*/-/files/:id', (schema) => {
return schema.db.files.map(({ path }) => path);
});
......
......@@ -4,7 +4,7 @@ export default {
},
print(element, serialize) {
element.$_hit = true;
element.querySelectorAll('[style]').forEach(el => {
element.querySelectorAll('[style]').forEach((el) => {
el.$_hit = true;
if (el.style.display === 'none') {
el.textContent = '(jest: contents hidden)';
......
......@@ -157,7 +157,7 @@ describe('Fly out sidebar navigation', () => {
'<div class="sidebar-sub-level-items" style="position: absolute; top: 0; left: 100px; height: 200px;"></div>';
});
it('shows sub-items after 0ms if no menu is open', done => {
it('shows sub-items after 0ms if no menu is open', (done) => {
mouseEnterTopItems(el);
expect(getHideSubItemsInterval()).toBe(0);
......@@ -169,7 +169,7 @@ describe('Fly out sidebar navigation', () => {
});
});
it('shows sub-items after 300ms if a menu is currently open', done => {
it('shows sub-items after 300ms if a menu is currently open', (done) => {
documentMouseMove({
clientX: el.getBoundingClientRect().left,
clientY: el.getBoundingClientRect().top,
......
......@@ -21,8 +21,8 @@ const PIXEL_TOLERANCE = 0.2;
* @param url
* @returns {Promise}
*/
const urlToImage = url =>
new Promise(resolve => {
const urlToImage = (url) =>
new Promise((resolve) => {
const img = new Image();
img.onload = function () {
resolve(img);
......@@ -64,10 +64,10 @@ describe('common_utils browser specific specs', () => {
});
describe('createOverlayIcon', () => {
it('should return the favicon with the overlay', done => {
it('should return the favicon with the overlay', (done) => {
commonUtils
.createOverlayIcon(faviconDataUrl, overlayDataUrl)
.then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then(([actual, expected]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done();
......@@ -88,11 +88,11 @@ describe('common_utils browser specific specs', () => {
document.body.removeChild(document.getElementById('favicon'));
});
it('should set page favicon to provided favicon overlay', done => {
it('should set page favicon to provided favicon overlay', (done) => {
commonUtils
.setFaviconOverlay(overlayDataUrl)
.then(() => document.getElementById('favicon').getAttribute('href'))
.then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then(([actual, expected]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done();
......@@ -119,7 +119,7 @@ describe('common_utils browser specific specs', () => {
document.body.removeChild(document.getElementById('favicon'));
});
it('should reset favicon in case of error', done => {
it('should reset favicon in case of error', (done) => {
mock.onGet(BUILD_URL).replyOnce(500);
commonUtils.setCiStatusFavicon(BUILD_URL).catch(() => {
......@@ -130,7 +130,7 @@ describe('common_utils browser specific specs', () => {
});
});
it('should set page favicon to CI status favicon based on provided status', done => {
it('should set page favicon to CI status favicon based on provided status', (done) => {
mock.onGet(BUILD_URL).reply(200, {
favicon: overlayDataUrl,
});
......@@ -138,7 +138,7 @@ describe('common_utils browser specific specs', () => {
commonUtils
.setCiStatusFavicon(BUILD_URL)
.then(() => document.getElementById('favicon').getAttribute('href'))
.then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then(([actual, expected]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done();
......
......@@ -2,7 +2,7 @@ import pixelmatch from 'pixelmatch';
export default {
toImageDiffEqual: () => {
const getImageData = img => {
const getImageData = (img) => {
const canvas = document.createElement('canvas');
canvas.width = img.width;
canvas.height = img.height;
......
......@@ -30,7 +30,7 @@ Vue.config.warnHandler = (msg, vm, trace) => {
const currentStack = new Error().stack;
const isInVueTestUtils = currentStack
.split('\n')
.some(line => line.startsWith(' at VueWrapper.setProps ('));
.some((line) => line.startsWith(' at VueWrapper.setProps ('));
if (isInVueTestUtils) {
return;
}
......@@ -75,7 +75,7 @@ gon.relative_url_root = '';
let hasUnhandledPromiseRejections = false;
window.addEventListener('unhandledrejection', event => {
window.addEventListener('unhandledrejection', (event) => {
hasUnhandledPromiseRejections = true;
console.error('Unhandled promise rejection:');
console.error(event.reason.stack || event.reason);
......@@ -87,11 +87,11 @@ window.addEventListener('unhandledrejection', event => {
// enough for the socket to continue to communicate.
// The downside is that it creates a minor performance penalty in the time it takes
// to run our unit tests.
beforeEach(done => done());
beforeEach((done) => done());
let longRunningTestTimeoutHandle;
beforeEach(done => {
beforeEach((done) => {
longRunningTestTimeoutHandle = setTimeout(() => {
done.fail('Test is running too long!');
}, 4000);
......@@ -111,8 +111,8 @@ if (process.env.IS_EE) {
testContexts.push(require.context('ee_spec', true, /_spec$/));
}
testContexts.forEach(context => {
context.keys().forEach(path => {
testContexts.forEach((context) => {
context.keys().forEach((path) => {
try {
context(path);
} catch (err) {
......@@ -128,7 +128,7 @@ testContexts.forEach(context => {
});
describe('test errors', () => {
beforeAll(done => {
beforeAll((done) => {
if (hasUnhandledPromiseRejections || hasVueWarnings || hasVueErrors) {
setTimeout(done, 1000);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment