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