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;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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