Commit 3b1593f2 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 29 files - 52 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 39bb37cc
......@@ -1531,37 +1531,6 @@ ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
ee/spec/frontend/roadmap/components/milestones_list_section_spec.js
## interesting-galileo
ee/spec/frontend/vue_shared/license_compliance/license_management_spec.js
ee/spec/frontend/vue_shared/license_compliance/mock_data.js
ee/spec/frontend/vue_shared/license_compliance/mr_widget_license_report_spec.js
ee/spec/frontend/vue_shared/license_compliance/store/actions_spec.js
ee/spec/frontend/vue_shared/license_compliance/store/getters_spec.js
ee/spec/frontend/vue_shared/security_reports/components/dast_modal_spec.js
ee/spec/frontend/vue_shared/security_reports/components/dismiss_button_spec.js
ee/spec/frontend/vue_shared/security_reports/components/modal_footer_spec.js
ee/spec/frontend/vue_shared/security_reports/components/modal_spec.js
ee/spec/frontend/vue_shared/security_reports/components/security_issue_body_spec.js
ee/spec/frontend/vue_shared/security_reports/components/split_button_spec.js
ee/spec/frontend/vue_shared/security_reports/components/vulnerability_details_spec.js
ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js
ee/spec/frontend/vue_shared/security_reports/store/actions_spec.js
ee/spec/frontend/vue_shared/security_reports/store/getters_spec.js
ee/spec/frontend/vue_shared/security_reports/store/mediator_spec.js
ee/spec/frontend/vue_shared/security_reports/store/modules/api_fuzzing/actions_spec.js
ee/spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js
ee/spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js
ee/spec/frontend/vulnerabilities/details_spec.js
ee/spec/frontend/vulnerabilities/header_spec.js
ee/spec/frontend/vulnerabilities/helpers_spec.js
ee/spec/frontend/vulnerabilities/history_comment_editor_spec.js
ee/spec/frontend/vulnerabilities/history_comment_spec.js
ee/spec/frontend/vulnerabilities/history_entry_spec.js
ee/spec/frontend/vulnerabilities/issue_link_spec.js
ee/spec/frontend/vulnerabilities/related_issues_spec.js
ee/spec/frontend/vulnerabilities/status_description_spec.js
ee/spec/frontend/vulnerabilities/vulnerability_state_dropdown_spec.js
## relaxed-goldwasser
spec/frontend/__mocks__/@gitlab/ui.js
spec/frontend/__mocks__/lodash/debounce.js
......
......@@ -178,7 +178,7 @@ describe('License Management', () => {
describe.each([true, false])(
'when licenseComplianceDeniesMr feature flag is %p',
licenseComplianceDeniesMr => {
(licenseComplianceDeniesMr) => {
it('should not show the developer only tooltip', () => {
createComponent({
state: { isLoadingManagedLicenses: false },
......
......@@ -62,7 +62,7 @@ export const generateReportGroup = ({ status = 'some-status', numberOfLicenses =
status,
name: `${status} group-name`,
description: `${status} group-description`,
licenses: range(numberOfLicenses).map(i => ({
licenses: range(numberOfLicenses).map((i) => ({
name: `${status} license-name-${i}`,
status,
})),
......
......@@ -225,7 +225,7 @@ describe('License Report MR Widget', () => {
`(
'given reports for: $givenStatuses it has $expectedNumberOfReportHeadings report headings',
({ givenStatuses, expectedNumberOfReportHeadings }) => {
const mockReportGroups = givenStatuses.map(status => generateReportGroup({ status }));
const mockReportGroups = givenStatuses.map((status) => generateReportGroup({ status }));
mountComponent({
getters: {
......@@ -245,7 +245,7 @@ describe('License Report MR Widget', () => {
it.each([0, 1, 2])(
'should include %d report items when section has that many licenses',
numberOfLicenses => {
(numberOfLicenses) => {
const mockReportGroups = [
generateReportGroup({
numberOfLicenses,
......
......@@ -33,7 +33,7 @@ describe('getters', () => {
state = createState();
});
it.each([5, null])('returns true if given license is being updated', licenseId => {
it.each([5, null])('returns true if given license is being updated', (licenseId) => {
state.pendingLicenses = [licenseId];
expect(getters.isLicenseBeingUpdated(state)(licenseId)).toBe(true);
......@@ -60,7 +60,7 @@ describe('getters', () => {
});
describe('isAddingNewLicense', () => {
it.each([true, false])('calls isLicenseBeingUpdated internally', returnValue => {
it.each([true, false])('calls isLicenseBeingUpdated internally', (returnValue) => {
const isLicenseBeingUpdatedMock = jest.fn().mockImplementation(() => returnValue);
expect(
getters.isAddingNewLicense({}, { isLicenseBeingUpdated: isLicenseBeingUpdatedMock }),
......@@ -131,7 +131,7 @@ describe('getters', () => {
it.each(['failed', 'neutral', 'success'])(
`it filters report-groups that don't have the given status: %s`,
status => {
(status) => {
const newLicenses = [{ status }];
expect(getters.licenseReportGroups({ newLicenses })).toEqual([
......
......@@ -13,7 +13,7 @@ describe('DAST Modal', () => {
const findDownloadLink = () => wrapper.find('[data-testid="download-link"]');
const createWrapper = propsData => {
const createWrapper = (propsData) => {
wrapper = shallowMount(Component, {
propsData: {
...defaultProps,
......
......@@ -5,7 +5,7 @@ import component from 'ee/vue_shared/security_reports/components/dismiss_button.
describe('DismissalButton', () => {
let wrapper;
const mountComponent = options => {
const mountComponent = (options) => {
wrapper = mount(component, options);
};
......
......@@ -7,7 +7,7 @@ import createState from 'ee/vue_shared/security_reports/store/state';
describe('Security Reports modal footer', () => {
let wrapper;
const mountComponent = propsData => {
const mountComponent = (propsData) => {
wrapper = mount(component, {
propsData: {
isCreatingIssue: false,
......
......@@ -101,7 +101,7 @@ describe('Security Reports modal', () => {
});
describe('with merge request created', () => {
it('renders the issue button as a single button', done => {
it('renders the issue button as a single button', (done) => {
const propsData = {
modal: createState().modal,
canCreateIssue: true,
......
......@@ -22,7 +22,7 @@ describe('Security Issue Body', () => {
const findReportLink = () => wrapper.find(ReportLink);
const createComponent = issue => {
const createComponent = (issue) => {
wrapper = shallowMount(SecurityIssueBody, {
propsData: {
issue,
......
......@@ -23,7 +23,7 @@ describe('Split Button', () => {
const findDropdown = () => wrapper.find(GlDropdown);
const findDropdownItems = () => wrapper.findAll(GlDropdownItem);
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(SplitButton, {
propsData: {
...props,
......
......@@ -16,7 +16,7 @@ function makeVulnerability(changes = {}) {
describe('VulnerabilityDetails component', () => {
let wrapper;
const componentFactory = vulnerability => {
const componentFactory = (vulnerability) => {
wrapper = mount(VulnerabilityDetails, {
propsData: { vulnerability },
});
......@@ -31,7 +31,7 @@ describe('VulnerabilityDetails component', () => {
}
};
const findLink = name => wrapper.find({ ref: `${name}Link` });
const findLink = (name) => wrapper.find({ ref: `${name}Link` });
const findRequest = () => wrapper.find({ ref: 'request' });
const findRecordedResponse = () => wrapper.find({ ref: 'recordedResponse' });
const findUnmodifiedResponse = () => wrapper.find({ ref: 'unmodifiedResponse' });
......@@ -343,7 +343,7 @@ describe('VulnerabilityDetails component', () => {
});
describe('pin test', () => {
const factory = vulnFinding => {
const factory = (vulnFinding) => {
wrapper = shallowMount(VulnerabilityDetails, {
propsData: {
vulnerability: vulnFinding,
......
......@@ -417,7 +417,7 @@ describe('Grouped security reports app', () => {
});
describe('coverage fuzzing reports', () => {
describe.each([true, false])('given featureEnabled is %s', shouldShowFuzzing => {
describe.each([true, false])('given featureEnabled is %s', (shouldShowFuzzing) => {
beforeEach(() => {
createWrapper(
{
......@@ -692,7 +692,7 @@ describe('Grouped security reports app', () => {
};
describe('with active MR', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({ mrState: mrStates.open }, done);
});
......@@ -704,7 +704,7 @@ describe('Grouped security reports app', () => {
});
describe('with active MR and diverged commit', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({ mrState: mrStates.open, divergedCommitsCount: 1 }, done);
});
......@@ -716,7 +716,7 @@ describe('Grouped security reports app', () => {
});
describe('with closed MR', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({ mrState: mrStates.closed }, done);
});
......@@ -726,7 +726,7 @@ describe('Grouped security reports app', () => {
});
describe('with merged MR', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({ mrState: mrStates.merged }, done);
});
......
......@@ -32,7 +32,7 @@ import { groupedTextBuilder } from 'ee/vue_shared/security_reports/store/utils';
const MOCK_PATH = 'fake/path.json';
const generateVuln = severity => ({ severity });
const generateVuln = (severity) => ({ severity });
describe('Security reports getters', () => {
let state = {};
......
......@@ -7,7 +7,7 @@ const mockedStore = {
dispatch: jest.fn(),
};
mockedStore.subscribe = callback => {
mockedStore.subscribe = (callback) => {
mockedStore.commit = callback;
};
......@@ -19,7 +19,7 @@ describe('security reports mediator', () => {
describe(types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS, () => {
const type = types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS;
it.each(Object.entries(updateIssueActionsMap).map(entry => entry.reverse()))(
it.each(Object.entries(updateIssueActionsMap).map((entry) => entry.reverse()))(
`should trigger %s on when a %s is updated`,
(action, category) => {
const payload = { category };
......
......@@ -25,7 +25,7 @@ describe('EE api fuzzing report actions', () => {
});
describe('updateVulnerability', () => {
it(`should commit ${types.UPDATE_VULNERABILITY} with the correct response`, done => {
it(`should commit ${types.UPDATE_VULNERABILITY} with the correct response`, (done) => {
testAction(
actions.updateVulnerability,
issue,
......@@ -43,7 +43,7 @@ describe('EE api fuzzing report actions', () => {
});
describe('setDiffEndpoint', () => {
it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, done => {
it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, (done) => {
testAction(
actions.setDiffEndpoint,
diffEndpoint,
......@@ -61,13 +61,13 @@ describe('EE api fuzzing report actions', () => {
});
describe('requestDiff', () => {
it(`should commit ${types.REQUEST_DIFF}`, done => {
it(`should commit ${types.REQUEST_DIFF}`, (done) => {
testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done);
});
});
describe('receiveDiffSuccess', () => {
it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, done => {
it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, (done) => {
testAction(
actions.receiveDiffSuccess,
reports,
......@@ -85,7 +85,7 @@ describe('EE api fuzzing report actions', () => {
});
describe('receiveDiffError', () => {
it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, done => {
it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, (done) => {
testAction(
actions.receiveDiffError,
error,
......@@ -124,7 +124,7 @@ describe('EE api fuzzing report actions', () => {
.replyOnce(200, reports.enrichData);
});
it('should dispatch the `receiveDiffSuccess` action', done => {
it('should dispatch the `receiveDiffSuccess` action', (done) => {
const { diff, enrichData } = reports;
testAction(
actions.fetchDiff,
......@@ -152,7 +152,7 @@ describe('EE api fuzzing report actions', () => {
mock.onGet(diffEndpoint).replyOnce(200, reports.diff);
});
it('should dispatch the `receiveDiffSuccess` action with empty enrich data', done => {
it('should dispatch the `receiveDiffSuccess` action with empty enrich data', (done) => {
const { diff } = reports;
const enrichData = [];
testAction(
......@@ -184,7 +184,7 @@ describe('EE api fuzzing report actions', () => {
.replyOnce(404);
});
it('should dispatch the `receiveError` action', done => {
it('should dispatch the `receiveError` action', (done) => {
testAction(
actions.fetchDiff,
{},
......@@ -205,7 +205,7 @@ describe('EE api fuzzing report actions', () => {
.replyOnce(200, reports.enrichData);
});
it('should dispatch the `receiveDiffError` action', done => {
it('should dispatch the `receiveDiffError` action', (done) => {
testAction(
actions.fetchDiff,
{},
......
......@@ -14,7 +14,7 @@ describe('EE sast report actions', () => {
});
describe('updateVulnerability', () => {
it(`should commit ${types.UPDATE_VULNERABILITY} with the correct response`, done => {
it(`should commit ${types.UPDATE_VULNERABILITY} with the correct response`, (done) => {
testAction(
actions.updateVulnerability,
issue,
......
......@@ -14,7 +14,7 @@ describe('EE secret detection report actions', () => {
});
describe('updateVulnerability', () => {
it(`should commit ${types.UPDATE_VULNERABILITY} with the correct response`, done => {
it(`should commit ${types.UPDATE_VULNERABILITY} with the correct response`, (done) => {
testAction(
actions.updateVulnerability,
issue,
......
......@@ -16,7 +16,7 @@ describe('Vulnerability Details', () => {
description: 'vulnerability description',
};
const createWrapper = vulnerabilityOverrides => {
const createWrapper = (vulnerabilityOverrides) => {
const propsData = {
vulnerability: { ...vulnerability, ...vulnerabilityOverrides },
};
......@@ -24,9 +24,9 @@ describe('Vulnerability Details', () => {
wrapper = mount(VulnerabilityDetails, { propsData });
};
const getById = id => wrapper.find(`[data-testid="${id}"]`);
const getAllById = id => wrapper.findAll(`[data-testid="${id}"]`);
const getText = id => getById(id).text();
const getById = (id) => wrapper.find(`[data-testid="${id}"]`);
const getAllById = (id) => wrapper.findAll(`[data-testid="${id}"]`);
const getText = (id) => getById(id).text();
afterEach(() => {
wrapper.destroy();
......@@ -212,17 +212,17 @@ describe('Vulnerability Details', () => {
isCode: true,
};
const getTextContent = el => el.textContent.trim();
const getLabel = el => getTextContent(getByTestId(el, 'label'));
const getContent = el => getTextContent(getByTestId(el, 'value'));
const getSectionData = testId => {
const getTextContent = (el) => el.textContent.trim();
const getLabel = (el) => getTextContent(getByTestId(el, 'label'));
const getContent = (el) => getTextContent(getByTestId(el, 'value'));
const getSectionData = (testId) => {
const section = getById(testId).element;
if (!section) {
return null;
}
return getAllByRole(section, 'listitem').map(li => ({
return getAllByRole(section, 'listitem').map((li) => ({
label: getLabel(li),
content: getContent(li),
...(li.querySelector('code') ? { isCode: true } : {}),
......
......@@ -375,7 +375,7 @@ describe('Vulnerability Header', () => {
describe('vulnerability user watcher', () => {
it.each(vulnerabilityStateEntries)(
`loads the correct user for the vulnerability state "%s"`,
state => {
(state) => {
const user = createRandomUser();
createWrapper({ vulnerability: { state, [`${state}ById`]: user.id } });
......
......@@ -5,7 +5,7 @@ describe('Vulnerabilities helpers', () => {
it.each([
{ iid: 135, web_url: 'some/url' },
{ iid: undefined, web_url: undefined },
])('returns formatted issue with expected properties for issue %s', issue => {
])('returns formatted issue with expected properties for issue %s', (issue) => {
const formattedIssue = getFormattedIssue(issue);
expect(formattedIssue).toMatchObject({
......
......@@ -5,7 +5,7 @@ import HistoryCommentEditor from 'ee/vulnerabilities/components/history_comment_
describe('History Comment Editor', () => {
let wrapper;
const createWrapper = props => {
const createWrapper = (props) => {
wrapper = shallowMount(HistoryCommentEditor, {
propsData: { isSaving: false, ...props },
});
......
......@@ -12,7 +12,7 @@ jest.mock('~/flash');
describe('History Comment', () => {
let wrapper;
const createWrapper = comment => {
const createWrapper = (comment) => {
wrapper = mount(HistoryComment, {
propsData: {
comment,
......
......@@ -42,7 +42,7 @@ describe('History Entry', () => {
const eventItem = () => wrapper.find(EventItem);
const newComment = () => wrapper.find({ ref: 'newComment' });
const existingComments = () => wrapper.findAll({ ref: 'existingComment' });
const commentAt = index => existingComments().at(index);
const commentAt = (index) => existingComments().at(index);
afterEach(() => wrapper.destroy());
......
......@@ -5,7 +5,7 @@ import { getBinding, createMockDirective } from 'helpers/vue_mock_directive';
describe('IssueLink component', () => {
let wrapper;
const createIssue = options => ({
const createIssue = (options) => ({
title: 'my-issue',
iid: 12,
webUrl: 'http://localhost/issues/~/12',
......@@ -21,8 +21,8 @@ describe('IssueLink component', () => {
});
};
const findIssueLink = id => wrapper.find(`[data-testid="issue-link-${id}"]`);
const findIssueWithState = state =>
const findIssueLink = (id) => wrapper.find(`[data-testid="issue-link-${id}"]`);
const findIssueWithState = (state) =>
wrapper.find(state === 'opened' ? 'issue-open-m' : 'issue-close');
afterEach(() => {
......
......@@ -54,7 +54,7 @@ describe('Vulnerability related issues component', () => {
};
const relatedIssuesBlock = () => wrapper.find(RelatedIssuesBlock);
const blockProp = prop => relatedIssuesBlock().props(prop);
const blockProp = (prop) => relatedIssuesBlock().props(prop);
const blockEmit = (eventName, data) => relatedIssuesBlock().vm.$emit(eventName, data);
const findCreateIssueButton = () => wrapper.find({ ref: 'createIssue' });
......
......@@ -30,7 +30,7 @@ describe('Vulnerability status description component', () => {
const statusEl = () => wrapper.find('[data-testid="status"]');
// Create a date using the passed-in string, or just use the current time if nothing was passed in.
const createDate = value => (value ? new Date(value) : new Date()).toISOString();
const createDate = (value) => (value ? new Date(value) : new Date()).toISOString();
const createWrapper = (props = {}) => {
const vulnerability = props.vulnerability || { pipeline: {} };
......@@ -47,7 +47,7 @@ describe('Vulnerability status description component', () => {
};
describe('state text', () => {
it.each(ALL_STATES)('shows the correct string for the vulnerability state "%s"', state => {
it.each(ALL_STATES)('shows the correct string for the vulnerability state "%s"', (state) => {
createWrapper({ vulnerability: { state, pipeline: {} } });
expect(wrapper.text()).toMatch(new RegExp(`^${capitalize(state)}`));
......@@ -78,9 +78,9 @@ describe('Vulnerability status description component', () => {
});
// The .map() is used to output the correct test name by doubling up the parameter, i.e. 'detected' -> ['detected', 'detected'].
it.each(NON_DETECTED_STATES.map(x => [x, x]))(
it.each(NON_DETECTED_STATES.map((x) => [x, x]))(
'uses the "%s_at" property when the vulnerability state is "%s"',
state => {
(state) => {
const expectedDate = createDate();
createWrapper({
vulnerability: {
......@@ -106,7 +106,7 @@ describe('Vulnerability status description component', () => {
it.each(NON_DETECTED_STATES)(
'does not show the pipeline link when the vulnerability state is "%s"',
state => {
(state) => {
createWrapper({
vulnerability: { state, pipeline: { url: 'pipeline/url' } },
});
......
......@@ -18,9 +18,9 @@ describe('Vulnerability state dropdown component', () => {
};
// isSelected is designed to work with both single VueWrapper or WrapperArray
const isSelected = items =>
Boolean((items.wrappers ?? [items]).find(w => w.find('.selected-icon').exists()));
const isDisabled = item => item.attributes('disabled') === 'true';
const isSelected = (items) =>
Boolean((items.wrappers ?? [items]).find((w) => w.find('.selected-icon').exists()));
const isDisabled = (item) => item.attributes('disabled') === 'true';
const dropdownItems = () => wrapper.findAll('.dropdown-item');
const firstUnselectedItem = () => wrapper.find('.dropdown-item:not(.selected)');
const selectedItem = () => wrapper.find('.dropdown-item.selected');
......@@ -28,8 +28,8 @@ describe('Vulnerability state dropdown component', () => {
const cancelButton = () => wrapper.find({ ref: 'cancel-button' });
const innerDropdown = () => wrapper.find({ ref: 'dropdown' });
const dropdownItemFor = stateEntry =>
dropdownItems().wrappers.find(x => {
const dropdownItemFor = (stateEntry) =>
dropdownItems().wrappers.find((x) => {
const text = x.text();
return text.includes(stateEntry.displayName) && text.includes(stateEntry.description);
});
......
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