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 ...@@ -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/epics_list_empty_spec.js
ee/spec/frontend/roadmap/components/milestones_list_section_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 ## relaxed-goldwasser
spec/frontend/__mocks__/@gitlab/ui.js spec/frontend/__mocks__/@gitlab/ui.js
spec/frontend/__mocks__/lodash/debounce.js spec/frontend/__mocks__/lodash/debounce.js
......
...@@ -178,7 +178,7 @@ describe('License Management', () => { ...@@ -178,7 +178,7 @@ describe('License Management', () => {
describe.each([true, false])( describe.each([true, false])(
'when licenseComplianceDeniesMr feature flag is %p', 'when licenseComplianceDeniesMr feature flag is %p',
licenseComplianceDeniesMr => { (licenseComplianceDeniesMr) => {
it('should not show the developer only tooltip', () => { it('should not show the developer only tooltip', () => {
createComponent({ createComponent({
state: { isLoadingManagedLicenses: false }, state: { isLoadingManagedLicenses: false },
......
...@@ -62,7 +62,7 @@ export const generateReportGroup = ({ status = 'some-status', numberOfLicenses = ...@@ -62,7 +62,7 @@ export const generateReportGroup = ({ status = 'some-status', numberOfLicenses =
status, status,
name: `${status} group-name`, name: `${status} group-name`,
description: `${status} group-description`, description: `${status} group-description`,
licenses: range(numberOfLicenses).map(i => ({ licenses: range(numberOfLicenses).map((i) => ({
name: `${status} license-name-${i}`, name: `${status} license-name-${i}`,
status, status,
})), })),
......
...@@ -225,7 +225,7 @@ describe('License Report MR Widget', () => { ...@@ -225,7 +225,7 @@ describe('License Report MR Widget', () => {
`( `(
'given reports for: $givenStatuses it has $expectedNumberOfReportHeadings report headings', 'given reports for: $givenStatuses it has $expectedNumberOfReportHeadings report headings',
({ givenStatuses, expectedNumberOfReportHeadings }) => { ({ givenStatuses, expectedNumberOfReportHeadings }) => {
const mockReportGroups = givenStatuses.map(status => generateReportGroup({ status })); const mockReportGroups = givenStatuses.map((status) => generateReportGroup({ status }));
mountComponent({ mountComponent({
getters: { getters: {
...@@ -245,7 +245,7 @@ describe('License Report MR Widget', () => { ...@@ -245,7 +245,7 @@ describe('License Report MR Widget', () => {
it.each([0, 1, 2])( it.each([0, 1, 2])(
'should include %d report items when section has that many licenses', 'should include %d report items when section has that many licenses',
numberOfLicenses => { (numberOfLicenses) => {
const mockReportGroups = [ const mockReportGroups = [
generateReportGroup({ generateReportGroup({
numberOfLicenses, numberOfLicenses,
......
...@@ -33,7 +33,7 @@ describe('getters', () => { ...@@ -33,7 +33,7 @@ describe('getters', () => {
state = createState(); 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]; state.pendingLicenses = [licenseId];
expect(getters.isLicenseBeingUpdated(state)(licenseId)).toBe(true); expect(getters.isLicenseBeingUpdated(state)(licenseId)).toBe(true);
...@@ -60,7 +60,7 @@ describe('getters', () => { ...@@ -60,7 +60,7 @@ describe('getters', () => {
}); });
describe('isAddingNewLicense', () => { describe('isAddingNewLicense', () => {
it.each([true, false])('calls isLicenseBeingUpdated internally', returnValue => { it.each([true, false])('calls isLicenseBeingUpdated internally', (returnValue) => {
const isLicenseBeingUpdatedMock = jest.fn().mockImplementation(() => returnValue); const isLicenseBeingUpdatedMock = jest.fn().mockImplementation(() => returnValue);
expect( expect(
getters.isAddingNewLicense({}, { isLicenseBeingUpdated: isLicenseBeingUpdatedMock }), getters.isAddingNewLicense({}, { isLicenseBeingUpdated: isLicenseBeingUpdatedMock }),
...@@ -131,7 +131,7 @@ describe('getters', () => { ...@@ -131,7 +131,7 @@ describe('getters', () => {
it.each(['failed', 'neutral', 'success'])( it.each(['failed', 'neutral', 'success'])(
`it filters report-groups that don't have the given status: %s`, `it filters report-groups that don't have the given status: %s`,
status => { (status) => {
const newLicenses = [{ status }]; const newLicenses = [{ status }];
expect(getters.licenseReportGroups({ newLicenses })).toEqual([ expect(getters.licenseReportGroups({ newLicenses })).toEqual([
......
...@@ -13,7 +13,7 @@ describe('DAST Modal', () => { ...@@ -13,7 +13,7 @@ describe('DAST Modal', () => {
const findDownloadLink = () => wrapper.find('[data-testid="download-link"]'); const findDownloadLink = () => wrapper.find('[data-testid="download-link"]');
const createWrapper = propsData => { const createWrapper = (propsData) => {
wrapper = shallowMount(Component, { wrapper = shallowMount(Component, {
propsData: { propsData: {
...defaultProps, ...defaultProps,
......
...@@ -5,7 +5,7 @@ import component from 'ee/vue_shared/security_reports/components/dismiss_button. ...@@ -5,7 +5,7 @@ import component from 'ee/vue_shared/security_reports/components/dismiss_button.
describe('DismissalButton', () => { describe('DismissalButton', () => {
let wrapper; let wrapper;
const mountComponent = options => { const mountComponent = (options) => {
wrapper = mount(component, options); wrapper = mount(component, options);
}; };
......
...@@ -7,7 +7,7 @@ import createState from 'ee/vue_shared/security_reports/store/state'; ...@@ -7,7 +7,7 @@ import createState from 'ee/vue_shared/security_reports/store/state';
describe('Security Reports modal footer', () => { describe('Security Reports modal footer', () => {
let wrapper; let wrapper;
const mountComponent = propsData => { const mountComponent = (propsData) => {
wrapper = mount(component, { wrapper = mount(component, {
propsData: { propsData: {
isCreatingIssue: false, isCreatingIssue: false,
......
...@@ -101,7 +101,7 @@ describe('Security Reports modal', () => { ...@@ -101,7 +101,7 @@ describe('Security Reports modal', () => {
}); });
describe('with merge request created', () => { 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 = { const propsData = {
modal: createState().modal, modal: createState().modal,
canCreateIssue: true, canCreateIssue: true,
......
...@@ -22,7 +22,7 @@ describe('Security Issue Body', () => { ...@@ -22,7 +22,7 @@ describe('Security Issue Body', () => {
const findReportLink = () => wrapper.find(ReportLink); const findReportLink = () => wrapper.find(ReportLink);
const createComponent = issue => { const createComponent = (issue) => {
wrapper = shallowMount(SecurityIssueBody, { wrapper = shallowMount(SecurityIssueBody, {
propsData: { propsData: {
issue, issue,
......
...@@ -23,7 +23,7 @@ describe('Split Button', () => { ...@@ -23,7 +23,7 @@ describe('Split Button', () => {
const findDropdown = () => wrapper.find(GlDropdown); const findDropdown = () => wrapper.find(GlDropdown);
const findDropdownItems = () => wrapper.findAll(GlDropdownItem); const findDropdownItems = () => wrapper.findAll(GlDropdownItem);
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(SplitButton, { wrapper = shallowMount(SplitButton, {
propsData: { propsData: {
...props, ...props,
......
...@@ -16,7 +16,7 @@ function makeVulnerability(changes = {}) { ...@@ -16,7 +16,7 @@ function makeVulnerability(changes = {}) {
describe('VulnerabilityDetails component', () => { describe('VulnerabilityDetails component', () => {
let wrapper; let wrapper;
const componentFactory = vulnerability => { const componentFactory = (vulnerability) => {
wrapper = mount(VulnerabilityDetails, { wrapper = mount(VulnerabilityDetails, {
propsData: { vulnerability }, propsData: { vulnerability },
}); });
...@@ -31,7 +31,7 @@ describe('VulnerabilityDetails component', () => { ...@@ -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 findRequest = () => wrapper.find({ ref: 'request' });
const findRecordedResponse = () => wrapper.find({ ref: 'recordedResponse' }); const findRecordedResponse = () => wrapper.find({ ref: 'recordedResponse' });
const findUnmodifiedResponse = () => wrapper.find({ ref: 'unmodifiedResponse' }); const findUnmodifiedResponse = () => wrapper.find({ ref: 'unmodifiedResponse' });
...@@ -343,7 +343,7 @@ describe('VulnerabilityDetails component', () => { ...@@ -343,7 +343,7 @@ describe('VulnerabilityDetails component', () => {
}); });
describe('pin test', () => { describe('pin test', () => {
const factory = vulnFinding => { const factory = (vulnFinding) => {
wrapper = shallowMount(VulnerabilityDetails, { wrapper = shallowMount(VulnerabilityDetails, {
propsData: { propsData: {
vulnerability: vulnFinding, vulnerability: vulnFinding,
......
...@@ -417,7 +417,7 @@ describe('Grouped security reports app', () => { ...@@ -417,7 +417,7 @@ describe('Grouped security reports app', () => {
}); });
describe('coverage fuzzing reports', () => { describe('coverage fuzzing reports', () => {
describe.each([true, false])('given featureEnabled is %s', shouldShowFuzzing => { describe.each([true, false])('given featureEnabled is %s', (shouldShowFuzzing) => {
beforeEach(() => { beforeEach(() => {
createWrapper( createWrapper(
{ {
...@@ -692,7 +692,7 @@ describe('Grouped security reports app', () => { ...@@ -692,7 +692,7 @@ describe('Grouped security reports app', () => {
}; };
describe('with active MR', () => { describe('with active MR', () => {
beforeEach(done => { beforeEach((done) => {
createComponent({ mrState: mrStates.open }, done); createComponent({ mrState: mrStates.open }, done);
}); });
...@@ -704,7 +704,7 @@ describe('Grouped security reports app', () => { ...@@ -704,7 +704,7 @@ describe('Grouped security reports app', () => {
}); });
describe('with active MR and diverged commit', () => { describe('with active MR and diverged commit', () => {
beforeEach(done => { beforeEach((done) => {
createComponent({ mrState: mrStates.open, divergedCommitsCount: 1 }, done); createComponent({ mrState: mrStates.open, divergedCommitsCount: 1 }, done);
}); });
...@@ -716,7 +716,7 @@ describe('Grouped security reports app', () => { ...@@ -716,7 +716,7 @@ describe('Grouped security reports app', () => {
}); });
describe('with closed MR', () => { describe('with closed MR', () => {
beforeEach(done => { beforeEach((done) => {
createComponent({ mrState: mrStates.closed }, done); createComponent({ mrState: mrStates.closed }, done);
}); });
...@@ -726,7 +726,7 @@ describe('Grouped security reports app', () => { ...@@ -726,7 +726,7 @@ describe('Grouped security reports app', () => {
}); });
describe('with merged MR', () => { describe('with merged MR', () => {
beforeEach(done => { beforeEach((done) => {
createComponent({ mrState: mrStates.merged }, done); createComponent({ mrState: mrStates.merged }, done);
}); });
......
...@@ -32,7 +32,7 @@ import { groupedTextBuilder } from 'ee/vue_shared/security_reports/store/utils'; ...@@ -32,7 +32,7 @@ import { groupedTextBuilder } from 'ee/vue_shared/security_reports/store/utils';
const MOCK_PATH = 'fake/path.json'; const MOCK_PATH = 'fake/path.json';
const generateVuln = severity => ({ severity }); const generateVuln = (severity) => ({ severity });
describe('Security reports getters', () => { describe('Security reports getters', () => {
let state = {}; let state = {};
......
...@@ -7,7 +7,7 @@ const mockedStore = { ...@@ -7,7 +7,7 @@ const mockedStore = {
dispatch: jest.fn(), dispatch: jest.fn(),
}; };
mockedStore.subscribe = callback => { mockedStore.subscribe = (callback) => {
mockedStore.commit = callback; mockedStore.commit = callback;
}; };
...@@ -19,7 +19,7 @@ describe('security reports mediator', () => { ...@@ -19,7 +19,7 @@ describe('security reports mediator', () => {
describe(types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS, () => { describe(types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS, () => {
const type = 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`, `should trigger %s on when a %s is updated`,
(action, category) => { (action, category) => {
const payload = { category }; const payload = { category };
......
...@@ -25,7 +25,7 @@ describe('EE api fuzzing report actions', () => { ...@@ -25,7 +25,7 @@ describe('EE api fuzzing report actions', () => {
}); });
describe('updateVulnerability', () => { 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( testAction(
actions.updateVulnerability, actions.updateVulnerability,
issue, issue,
...@@ -43,7 +43,7 @@ describe('EE api fuzzing report actions', () => { ...@@ -43,7 +43,7 @@ describe('EE api fuzzing 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,
...@@ -61,13 +61,13 @@ describe('EE api fuzzing report actions', () => { ...@@ -61,13 +61,13 @@ describe('EE api fuzzing 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,
...@@ -85,7 +85,7 @@ describe('EE api fuzzing report actions', () => { ...@@ -85,7 +85,7 @@ describe('EE api fuzzing 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,
...@@ -124,7 +124,7 @@ describe('EE api fuzzing report actions', () => { ...@@ -124,7 +124,7 @@ describe('EE api fuzzing 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,
...@@ -152,7 +152,7 @@ describe('EE api fuzzing report actions', () => { ...@@ -152,7 +152,7 @@ describe('EE api fuzzing 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(
...@@ -184,7 +184,7 @@ describe('EE api fuzzing report actions', () => { ...@@ -184,7 +184,7 @@ describe('EE api fuzzing 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,
{}, {},
...@@ -205,7 +205,7 @@ describe('EE api fuzzing report actions', () => { ...@@ -205,7 +205,7 @@ describe('EE api fuzzing 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,
{}, {},
......
...@@ -14,7 +14,7 @@ describe('EE sast report actions', () => { ...@@ -14,7 +14,7 @@ describe('EE sast report actions', () => {
}); });
describe('updateVulnerability', () => { 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( testAction(
actions.updateVulnerability, actions.updateVulnerability,
issue, issue,
......
...@@ -14,7 +14,7 @@ describe('EE secret detection report actions', () => { ...@@ -14,7 +14,7 @@ describe('EE secret detection report actions', () => {
}); });
describe('updateVulnerability', () => { 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( testAction(
actions.updateVulnerability, actions.updateVulnerability,
issue, issue,
......
...@@ -16,7 +16,7 @@ describe('Vulnerability Details', () => { ...@@ -16,7 +16,7 @@ describe('Vulnerability Details', () => {
description: 'vulnerability description', description: 'vulnerability description',
}; };
const createWrapper = vulnerabilityOverrides => { const createWrapper = (vulnerabilityOverrides) => {
const propsData = { const propsData = {
vulnerability: { ...vulnerability, ...vulnerabilityOverrides }, vulnerability: { ...vulnerability, ...vulnerabilityOverrides },
}; };
...@@ -24,9 +24,9 @@ describe('Vulnerability Details', () => { ...@@ -24,9 +24,9 @@ describe('Vulnerability Details', () => {
wrapper = mount(VulnerabilityDetails, { propsData }); wrapper = mount(VulnerabilityDetails, { propsData });
}; };
const getById = id => wrapper.find(`[data-testid="${id}"]`); const getById = (id) => wrapper.find(`[data-testid="${id}"]`);
const getAllById = id => wrapper.findAll(`[data-testid="${id}"]`); const getAllById = (id) => wrapper.findAll(`[data-testid="${id}"]`);
const getText = id => getById(id).text(); const getText = (id) => getById(id).text();
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -212,17 +212,17 @@ describe('Vulnerability Details', () => { ...@@ -212,17 +212,17 @@ describe('Vulnerability Details', () => {
isCode: true, isCode: true,
}; };
const getTextContent = el => el.textContent.trim(); const getTextContent = (el) => el.textContent.trim();
const getLabel = el => getTextContent(getByTestId(el, 'label')); const getLabel = (el) => getTextContent(getByTestId(el, 'label'));
const getContent = el => getTextContent(getByTestId(el, 'value')); const getContent = (el) => getTextContent(getByTestId(el, 'value'));
const getSectionData = testId => { const getSectionData = (testId) => {
const section = getById(testId).element; const section = getById(testId).element;
if (!section) { if (!section) {
return null; return null;
} }
return getAllByRole(section, 'listitem').map(li => ({ return getAllByRole(section, 'listitem').map((li) => ({
label: getLabel(li), label: getLabel(li),
content: getContent(li), content: getContent(li),
...(li.querySelector('code') ? { isCode: true } : {}), ...(li.querySelector('code') ? { isCode: true } : {}),
......
...@@ -375,7 +375,7 @@ describe('Vulnerability Header', () => { ...@@ -375,7 +375,7 @@ describe('Vulnerability Header', () => {
describe('vulnerability user watcher', () => { describe('vulnerability user watcher', () => {
it.each(vulnerabilityStateEntries)( it.each(vulnerabilityStateEntries)(
`loads the correct user for the vulnerability state "%s"`, `loads the correct user for the vulnerability state "%s"`,
state => { (state) => {
const user = createRandomUser(); const user = createRandomUser();
createWrapper({ vulnerability: { state, [`${state}ById`]: user.id } }); createWrapper({ vulnerability: { state, [`${state}ById`]: user.id } });
......
...@@ -5,7 +5,7 @@ describe('Vulnerabilities helpers', () => { ...@@ -5,7 +5,7 @@ describe('Vulnerabilities helpers', () => {
it.each([ it.each([
{ iid: 135, web_url: 'some/url' }, { iid: 135, web_url: 'some/url' },
{ iid: undefined, web_url: undefined }, { 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); const formattedIssue = getFormattedIssue(issue);
expect(formattedIssue).toMatchObject({ expect(formattedIssue).toMatchObject({
......
...@@ -5,7 +5,7 @@ import HistoryCommentEditor from 'ee/vulnerabilities/components/history_comment_ ...@@ -5,7 +5,7 @@ import HistoryCommentEditor from 'ee/vulnerabilities/components/history_comment_
describe('History Comment Editor', () => { describe('History Comment Editor', () => {
let wrapper; let wrapper;
const createWrapper = props => { const createWrapper = (props) => {
wrapper = shallowMount(HistoryCommentEditor, { wrapper = shallowMount(HistoryCommentEditor, {
propsData: { isSaving: false, ...props }, propsData: { isSaving: false, ...props },
}); });
......
...@@ -12,7 +12,7 @@ jest.mock('~/flash'); ...@@ -12,7 +12,7 @@ jest.mock('~/flash');
describe('History Comment', () => { describe('History Comment', () => {
let wrapper; let wrapper;
const createWrapper = comment => { const createWrapper = (comment) => {
wrapper = mount(HistoryComment, { wrapper = mount(HistoryComment, {
propsData: { propsData: {
comment, comment,
......
...@@ -42,7 +42,7 @@ describe('History Entry', () => { ...@@ -42,7 +42,7 @@ describe('History Entry', () => {
const eventItem = () => wrapper.find(EventItem); const eventItem = () => wrapper.find(EventItem);
const newComment = () => wrapper.find({ ref: 'newComment' }); const newComment = () => wrapper.find({ ref: 'newComment' });
const existingComments = () => wrapper.findAll({ ref: 'existingComment' }); const existingComments = () => wrapper.findAll({ ref: 'existingComment' });
const commentAt = index => existingComments().at(index); const commentAt = (index) => existingComments().at(index);
afterEach(() => wrapper.destroy()); afterEach(() => wrapper.destroy());
......
...@@ -5,7 +5,7 @@ import { getBinding, createMockDirective } from 'helpers/vue_mock_directive'; ...@@ -5,7 +5,7 @@ import { getBinding, createMockDirective } from 'helpers/vue_mock_directive';
describe('IssueLink component', () => { describe('IssueLink component', () => {
let wrapper; let wrapper;
const createIssue = options => ({ const createIssue = (options) => ({
title: 'my-issue', title: 'my-issue',
iid: 12, iid: 12,
webUrl: 'http://localhost/issues/~/12', webUrl: 'http://localhost/issues/~/12',
...@@ -21,8 +21,8 @@ describe('IssueLink component', () => { ...@@ -21,8 +21,8 @@ describe('IssueLink component', () => {
}); });
}; };
const findIssueLink = id => wrapper.find(`[data-testid="issue-link-${id}"]`); const findIssueLink = (id) => wrapper.find(`[data-testid="issue-link-${id}"]`);
const findIssueWithState = state => const findIssueWithState = (state) =>
wrapper.find(state === 'opened' ? 'issue-open-m' : 'issue-close'); wrapper.find(state === 'opened' ? 'issue-open-m' : 'issue-close');
afterEach(() => { afterEach(() => {
......
...@@ -54,7 +54,7 @@ describe('Vulnerability related issues component', () => { ...@@ -54,7 +54,7 @@ describe('Vulnerability related issues component', () => {
}; };
const relatedIssuesBlock = () => wrapper.find(RelatedIssuesBlock); 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 blockEmit = (eventName, data) => relatedIssuesBlock().vm.$emit(eventName, data);
const findCreateIssueButton = () => wrapper.find({ ref: 'createIssue' }); const findCreateIssueButton = () => wrapper.find({ ref: 'createIssue' });
......
...@@ -30,7 +30,7 @@ describe('Vulnerability status description component', () => { ...@@ -30,7 +30,7 @@ describe('Vulnerability status description component', () => {
const statusEl = () => wrapper.find('[data-testid="status"]'); 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. // 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 createWrapper = (props = {}) => {
const vulnerability = props.vulnerability || { pipeline: {} }; const vulnerability = props.vulnerability || { pipeline: {} };
...@@ -47,7 +47,7 @@ describe('Vulnerability status description component', () => { ...@@ -47,7 +47,7 @@ describe('Vulnerability status description component', () => {
}; };
describe('state text', () => { 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: {} } }); createWrapper({ vulnerability: { state, pipeline: {} } });
expect(wrapper.text()).toMatch(new RegExp(`^${capitalize(state)}`)); expect(wrapper.text()).toMatch(new RegExp(`^${capitalize(state)}`));
...@@ -78,9 +78,9 @@ describe('Vulnerability status description component', () => { ...@@ -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']. // 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"', 'uses the "%s_at" property when the vulnerability state is "%s"',
state => { (state) => {
const expectedDate = createDate(); const expectedDate = createDate();
createWrapper({ createWrapper({
vulnerability: { vulnerability: {
...@@ -106,7 +106,7 @@ describe('Vulnerability status description component', () => { ...@@ -106,7 +106,7 @@ describe('Vulnerability status description component', () => {
it.each(NON_DETECTED_STATES)( it.each(NON_DETECTED_STATES)(
'does not show the pipeline link when the vulnerability state is "%s"', 'does not show the pipeline link when the vulnerability state is "%s"',
state => { (state) => {
createWrapper({ createWrapper({
vulnerability: { state, pipeline: { url: 'pipeline/url' } }, vulnerability: { state, pipeline: { url: 'pipeline/url' } },
}); });
......
...@@ -18,9 +18,9 @@ describe('Vulnerability state dropdown component', () => { ...@@ -18,9 +18,9 @@ describe('Vulnerability state dropdown component', () => {
}; };
// isSelected is designed to work with both single VueWrapper or WrapperArray // isSelected is designed to work with both single VueWrapper or WrapperArray
const isSelected = items => const isSelected = (items) =>
Boolean((items.wrappers ?? [items]).find(w => w.find('.selected-icon').exists())); Boolean((items.wrappers ?? [items]).find((w) => w.find('.selected-icon').exists()));
const isDisabled = item => item.attributes('disabled') === 'true'; const isDisabled = (item) => item.attributes('disabled') === 'true';
const dropdownItems = () => wrapper.findAll('.dropdown-item'); const dropdownItems = () => wrapper.findAll('.dropdown-item');
const firstUnselectedItem = () => wrapper.find('.dropdown-item:not(.selected)'); const firstUnselectedItem = () => wrapper.find('.dropdown-item:not(.selected)');
const selectedItem = () => wrapper.find('.dropdown-item.selected'); const selectedItem = () => wrapper.find('.dropdown-item.selected');
...@@ -28,8 +28,8 @@ describe('Vulnerability state dropdown component', () => { ...@@ -28,8 +28,8 @@ describe('Vulnerability state dropdown component', () => {
const cancelButton = () => wrapper.find({ ref: 'cancel-button' }); const cancelButton = () => wrapper.find({ ref: 'cancel-button' });
const innerDropdown = () => wrapper.find({ ref: 'dropdown' }); const innerDropdown = () => wrapper.find({ ref: 'dropdown' });
const dropdownItemFor = stateEntry => const dropdownItemFor = (stateEntry) =>
dropdownItems().wrappers.find(x => { dropdownItems().wrappers.find((x) => {
const text = x.text(); const text = x.text();
return text.includes(stateEntry.displayName) && text.includes(stateEntry.description); 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