Commit 87ad67fe authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 41 files - 49 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
...@@ -1531,49 +1531,6 @@ ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js ...@@ -1531,49 +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
## compassionate-aryabhata
ee/spec/frontend/roadmap/components/preset_months/months_header_sub_item_spec.js
ee/spec/frontend/roadmap/components/preset_quarters/quarters_header_item_spec.js
ee/spec/frontend/roadmap/components/preset_quarters/quarters_header_sub_item_spec.js
ee/spec/frontend/roadmap/components/preset_weeks/weeks_header_sub_item_spec.js
ee/spec/frontend/roadmap/store/actions_spec.js
ee/spec/frontend/roadmap/store/mutations_spec.js
ee/spec/frontend/saml_providers/dirty_form_checker_spec.js
ee/spec/frontend/saml_providers/saml_settings_form_spec.js
ee/spec/frontend/scim_token/scim_token_toggle_area_spec.js
ee/spec/frontend/security_configuration/components/app_spec.js
ee/spec/frontend/security_configuration/components/feature_status_spec.js
ee/spec/frontend/security_configuration/components/helpers.js
ee/spec/frontend/security_configuration/components/manage_feature_spec.js
ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_list_spec.js
ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_spec.js
ee/spec/frontend/security_configuration/dast_profiles/components/dast_site_profiles_list_spec.js
ee/spec/frontend/security_configuration/dast_scanner_profiles_form/components/dast_scanner_profiles_form_spec.js
ee/spec/frontend/security_configuration/dast_site_profiles_form/components/dast_site_auth_section_spec.js
ee/spec/frontend/security_configuration/sast/components/configuration_form_spec.js
ee/spec/frontend/security_configuration/sast/components/dynamic_fields_spec.js
ee/spec/frontend/security_configuration/sast/components/helpers.js
ee/spec/frontend/security_configuration/sast/components/utils_spec.js
ee/spec/frontend/security_dashboard/components/auto_fix_help_text_spec.js
ee/spec/frontend/security_dashboard/components/filters/filter_body_spec.js
ee/spec/frontend/security_dashboard/components/filters/filter_item_spec.js
ee/spec/frontend/security_dashboard/components/filters/standard_filter_spec.js
ee/spec/frontend/security_dashboard/components/first_class_project_manager/project_list_spec.js
ee/spec/frontend/security_dashboard/components/first_class_project_security_dashboard_spec.js
ee/spec/frontend/security_dashboard/components/first_class_vulnerability_severities_spec.js
ee/spec/frontend/security_dashboard/components/loading_error_spec.js
ee/spec/frontend/security_dashboard/components/pipeline_security_dashboard_spec.js
ee/spec/frontend/security_dashboard/components/pipeline_status_badge_spec.js
ee/spec/frontend/security_dashboard/components/security_charts_layout_spec.js
ee/spec/frontend/security_dashboard/components/security_dashboard_layout_spec.js
ee/spec/frontend/security_dashboard/components/security_dashboard_table_row_spec.js
ee/spec/frontend/security_dashboard/components/security_dashboard_vuex_spec.js
ee/spec/frontend/security_dashboard/components/security_reports_summary_spec.js
ee/spec/frontend/security_dashboard/components/security_scanner_alert_spec.js
ee/spec/frontend/security_dashboard/components/selection_summary_spec.js
ee/spec/frontend/security_dashboard/components/selection_summary_vuex_spec.js
ee/spec/frontend/security_dashboard/components/vulnerability_count_list_layout_spec.js
## jovial-haslett ## jovial-haslett
ee/spec/frontend/security_dashboard/helpers.js ee/spec/frontend/security_dashboard/helpers.js
ee/spec/frontend/security_dashboard/helpers_spec.js ee/spec/frontend/security_dashboard/helpers_spec.js
......
...@@ -43,7 +43,7 @@ describe('MonthsHeaderSubItemComponent', () => { ...@@ -43,7 +43,7 @@ describe('MonthsHeaderSubItemComponent', () => {
vm = createComponent({}); vm = createComponent({});
expect(Array.isArray(vm.headerSubItems)).toBe(true); expect(Array.isArray(vm.headerSubItems)).toBe(true);
vm.headerSubItems.forEach(subItem => { vm.headerSubItems.forEach((subItem) => {
expect(subItem instanceof Date).toBe(true); expect(subItem instanceof Date).toBe(true);
}); });
}); });
......
...@@ -76,7 +76,7 @@ describe('QuartersHeaderItemComponent', () => { ...@@ -76,7 +76,7 @@ describe('QuartersHeaderItemComponent', () => {
expect(vm.timelineHeaderClass).toBe(''); expect(vm.timelineHeaderClass).toBe('');
}); });
it('returns string containing `label-dark label-bold` when current quarter is same as timeframeItem quarter', done => { it('returns string containing `label-dark label-bold` when current quarter is same as timeframeItem quarter', (done) => {
vm = createComponent({ vm = createComponent({
timeframeItem: mockTimeframeQuarters[1], timeframeItem: mockTimeframeQuarters[1],
}); });
......
...@@ -59,7 +59,7 @@ describe('QuartersHeaderSubItemComponent', () => { ...@@ -59,7 +59,7 @@ describe('QuartersHeaderSubItemComponent', () => {
vm = createComponent({}); vm = createComponent({});
expect(Array.isArray(vm.headerSubItems)).toBe(true); expect(Array.isArray(vm.headerSubItems)).toBe(true);
vm.headerSubItems.forEach(subItem => { vm.headerSubItems.forEach((subItem) => {
expect(subItem instanceof Date).toBe(true); expect(subItem instanceof Date).toBe(true);
}); });
}); });
......
...@@ -44,7 +44,7 @@ describe('MonthsHeaderSubItemComponent', () => { ...@@ -44,7 +44,7 @@ describe('MonthsHeaderSubItemComponent', () => {
expect(Array.isArray(vm.headerSubItems)).toBe(true); expect(Array.isArray(vm.headerSubItems)).toBe(true);
expect(vm.headerSubItems).toHaveLength(7); expect(vm.headerSubItems).toHaveLength(7);
vm.headerSubItems.forEach(subItem => { vm.headerSubItems.forEach((subItem) => {
expect(subItem instanceof Date).toBe(true); expect(subItem instanceof Date).toBe(true);
}); });
}); });
......
...@@ -332,7 +332,7 @@ describe('Roadmap Vuex Actions', () => { ...@@ -332,7 +332,7 @@ describe('Roadmap Vuex Actions', () => {
describe('refreshEpicDates', () => { describe('refreshEpicDates', () => {
it('should update epics after refreshing epic dates to match with updated timeframe', () => { it('should update epics after refreshing epic dates to match with updated timeframe', () => {
const epics = rawEpics.map(epic => const epics = rawEpics.map((epic) =>
roadmapItemUtils.formatRoadmapItemDetails( roadmapItemUtils.formatRoadmapItemDetails(
epic, epic,
state.timeframeStartDate, state.timeframeStartDate,
...@@ -747,7 +747,7 @@ describe('Roadmap Vuex Actions', () => { ...@@ -747,7 +747,7 @@ describe('Roadmap Vuex Actions', () => {
describe('refreshMilestoneDates', () => { describe('refreshMilestoneDates', () => {
it('should update milestones after refreshing milestone dates to match with updated timeframe', () => { it('should update milestones after refreshing milestone dates to match with updated timeframe', () => {
const milestones = rawMilestones.map(milestone => const milestones = rawMilestones.map((milestone) =>
roadmapItemUtils.formatRoadmapItemDetails( roadmapItemUtils.formatRoadmapItemDetails(
milestone, milestone,
state.timeframeStartDate, state.timeframeStartDate,
......
...@@ -11,7 +11,7 @@ import { ...@@ -11,7 +11,7 @@ import {
mockEpic, mockEpic,
} from 'ee_jest/roadmap/mock_data'; } from 'ee_jest/roadmap/mock_data';
const setEpicMockData = state => { const setEpicMockData = (state) => {
state.epics = [mockEpic]; state.epics = [mockEpic];
state.childrenFlags = { 'gid://gitlab/Epic/1': {} }; state.childrenFlags = { 'gid://gitlab/Epic/1': {} };
state.epicIds = ['gid://gitlab/Epic/1']; state.epicIds = ['gid://gitlab/Epic/1'];
...@@ -157,7 +157,7 @@ describe('Roadmap Store Mutations', () => { ...@@ -157,7 +157,7 @@ describe('Roadmap Store Mutations', () => {
mutations[types.INIT_EPIC_CHILDREN_FLAGS](state, { epics }); mutations[types.INIT_EPIC_CHILDREN_FLAGS](state, { epics });
epics.forEach(item => { epics.forEach((item) => {
expect(state.childrenFlags[item.id]).toMatchObject({ expect(state.childrenFlags[item.id]).toMatchObject({
itemExpanded: false, itemExpanded: false,
itemChildrenFetchInProgress: false, itemChildrenFetchInProgress: false,
......
...@@ -15,7 +15,7 @@ describe('DirtyFormChecker', () => { ...@@ -15,7 +15,7 @@ describe('DirtyFormChecker', () => {
}); });
it('finds editable inputs', () => { it('finds editable inputs', () => {
const editableInputs = dirtyFormChecker.editableInputs.map(input => input.name); const editableInputs = dirtyFormChecker.editableInputs.map((input) => input.name);
expect(editableInputs).toContain('saml_provider[sso_url]'); expect(editableInputs).toContain('saml_provider[sso_url]');
expect(editableInputs).not.toContain('authenticity_token'); expect(editableInputs).not.toContain('authenticity_token');
......
...@@ -31,7 +31,7 @@ describe('SamlSettingsForm', () => { ...@@ -31,7 +31,7 @@ describe('SamlSettingsForm', () => {
}); });
it('keeps Test button disabled when SAML disabled for the group', () => { it('keeps Test button disabled when SAML disabled for the group', () => {
samlSettingsForm.settings.find(s => s.name === 'group-saml').value = false; samlSettingsForm.settings.find((s) => s.name === 'group-saml').value = false;
samlSettingsForm.testButton.setAttribute('disabled', true); samlSettingsForm.testButton.setAttribute('disabled', true);
samlSettingsForm.updateView(); samlSettingsForm.updateView();
...@@ -41,15 +41,15 @@ describe('SamlSettingsForm', () => { ...@@ -41,15 +41,15 @@ describe('SamlSettingsForm', () => {
}); });
it('correctly disables dependent toggle', () => { it('correctly disables dependent toggle', () => {
samlSettingsForm.settings.forEach(s => { samlSettingsForm.settings.forEach((s) => {
const { input } = s; const { input } = s;
input.value = true; input.value = true;
}); });
const findEnforcedGroupManagedAccountSetting = () => const findEnforcedGroupManagedAccountSetting = () =>
samlSettingsForm.settings.find(s => s.name === 'enforced-group-managed-accounts'); samlSettingsForm.settings.find((s) => s.name === 'enforced-group-managed-accounts');
const findProhibitForksSetting = () => const findProhibitForksSetting = () =>
samlSettingsForm.settings.find(s => s.name === 'prohibited-outer-forks'); samlSettingsForm.settings.find((s) => s.name === 'prohibited-outer-forks');
samlSettingsForm.updateSAMLSettings(); samlSettingsForm.updateSAMLSettings();
samlSettingsForm.updateView(); samlSettingsForm.updateView();
...@@ -66,7 +66,7 @@ describe('SamlSettingsForm', () => { ...@@ -66,7 +66,7 @@ describe('SamlSettingsForm', () => {
}); });
it('correctly disables multiple dependent toggles', () => { it('correctly disables multiple dependent toggles', () => {
samlSettingsForm.settings.forEach(s => { samlSettingsForm.settings.forEach((s) => {
const { input } = s; const { input } = s;
input.value = true; input.value = true;
}); });
...@@ -77,8 +77,8 @@ describe('SamlSettingsForm', () => { ...@@ -77,8 +77,8 @@ describe('SamlSettingsForm', () => {
samlSettingsForm.updateSAMLSettings(); samlSettingsForm.updateSAMLSettings();
samlSettingsForm.updateView(); samlSettingsForm.updateView();
[groupSamlSetting, ...otherSettings] = samlSettingsForm.settings; [groupSamlSetting, ...otherSettings] = samlSettingsForm.settings;
expect(samlSettingsForm.settings.every(s => s.value)).toBe(true); expect(samlSettingsForm.settings.every((s) => s.value)).toBe(true);
expect(samlSettingsForm.settings.some(s => s.toggle.hasAttribute('disabled'))).toBe(false); expect(samlSettingsForm.settings.some((s) => s.toggle.hasAttribute('disabled'))).toBe(false);
groupSamlSetting.input.value = false; groupSamlSetting.input.value = false;
samlSettingsForm.updateSAMLSettings(); samlSettingsForm.updateSAMLSettings();
...@@ -86,8 +86,8 @@ describe('SamlSettingsForm', () => { ...@@ -86,8 +86,8 @@ describe('SamlSettingsForm', () => {
return new Promise(window.requestAnimationFrame).then(() => { return new Promise(window.requestAnimationFrame).then(() => {
[groupSamlSetting, ...otherSettings] = samlSettingsForm.settings; [groupSamlSetting, ...otherSettings] = samlSettingsForm.settings;
expect(otherSettings.every(s => s.value)).toBe(true); expect(otherSettings.every((s) => s.value)).toBe(true);
expect(otherSettings.every(s => s.toggle.hasAttribute('disabled'))).toBe(true); expect(otherSettings.every((s) => s.toggle.hasAttribute('disabled'))).toBe(true);
}); });
}); });
}); });
...@@ -42,7 +42,7 @@ describe('SCIMTokenToggleArea', () => { ...@@ -42,7 +42,7 @@ describe('SCIMTokenToggleArea', () => {
}); });
describe('generateSCIMToken', () => { describe('generateSCIMToken', () => {
it('toggles the generate and scim token forms', done => { it('toggles the generate and scim token forms', (done) => {
scimTokenToggleArea scimTokenToggleArea
.generateSCIMToken() .generateSCIMToken()
.then(() => { .then(() => {
...@@ -53,7 +53,7 @@ describe('SCIMTokenToggleArea', () => { ...@@ -53,7 +53,7 @@ describe('SCIMTokenToggleArea', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('populates the scim form with the token data', done => { it('populates the scim form with the token data', (done) => {
scimTokenToggleArea scimTokenToggleArea
.generateSCIMToken() .generateSCIMToken()
.then(() => { .then(() => {
...@@ -74,7 +74,7 @@ describe('SCIMTokenToggleArea', () => { ...@@ -74,7 +74,7 @@ describe('SCIMTokenToggleArea', () => {
expect(mockGenerateNewSCIMToken).not.toHaveBeenCalled(); expect(mockGenerateNewSCIMToken).not.toHaveBeenCalled();
}); });
it('populates the scim form with the token data if the confirm is accepted', done => { it('populates the scim form with the token data if the confirm is accepted', (done) => {
jest.spyOn(window, 'confirm').mockReturnValue(true); jest.spyOn(window, 'confirm').mockReturnValue(true);
scimTokenToggleArea scimTokenToggleArea
......
...@@ -55,7 +55,7 @@ describe('Security Configuration App', () => { ...@@ -55,7 +55,7 @@ describe('Security Configuration App', () => {
const getFeaturesTable = () => wrapper.find({ ref: 'securityControlTable' }); const getFeaturesTable = () => wrapper.find({ ref: 'securityControlTable' });
const getFeaturesRows = () => getFeaturesTable().findAll('tbody tr'); const getFeaturesRows = () => getFeaturesTable().findAll('tbody tr');
const getAlert = () => wrapper.find(GlAlert); const getAlert = () => wrapper.find(GlAlert);
const getRowCells = row => { const getRowCells = (row) => {
const [feature, status, manage] = row.findAll('td').wrappers; const [feature, status, manage] = row.findAll('td').wrappers;
return { feature, status, manage }; return { feature, status, manage };
}; };
......
...@@ -9,7 +9,7 @@ describe('FeatureStatus component', () => { ...@@ -9,7 +9,7 @@ describe('FeatureStatus component', () => {
let wrapper; let wrapper;
let feature; let feature;
const createComponent = options => { const createComponent = (options) => {
wrapper = shallowMount(FeatureStatus, options); wrapper = shallowMount(FeatureStatus, options);
}; };
......
export const generateFeatures = (n, overrides = {}) => { export const generateFeatures = (n, overrides = {}) => {
return [...Array(n).keys()].map(i => ({ return [...Array(n).keys()].map((i) => ({
type: `scan-type-${i}`, type: `scan-type-${i}`,
name: `name-feature-${i}`, name: `name-feature-${i}`,
description: `description-feature-${i}`, description: `description-feature-${i}`,
......
...@@ -10,7 +10,7 @@ describe('ManageFeature component', () => { ...@@ -10,7 +10,7 @@ describe('ManageFeature component', () => {
let wrapper; let wrapper;
let feature; let feature;
const createComponent = options => { const createComponent = (options) => {
wrapper = shallowMount( wrapper = shallowMount(
ManageFeature, ManageFeature,
merge( merge(
...@@ -30,7 +30,7 @@ describe('ManageFeature component', () => { ...@@ -30,7 +30,7 @@ describe('ManageFeature component', () => {
}); });
const findCreateMergeRequestButton = () => wrapper.find(CreateMergeRequestButton); const findCreateMergeRequestButton = () => wrapper.find(CreateMergeRequestButton);
const findTestId = id => wrapper.find(`[data-testid="${id}"]`); const findTestId = (id) => wrapper.find(`[data-testid="${id}"]`);
describe('given sastConfigurationUi feature flag is enabled', () => { describe('given sastConfigurationUi feature flag is enabled', () => {
const featureFlagEnabled = { const featureFlagEnabled = {
......
...@@ -56,7 +56,7 @@ describe('EE - DastProfilesList', () => { ...@@ -56,7 +56,7 @@ describe('EE - DastProfilesList', () => {
const getAllLoadingIndicators = () => withinComponent().queryAllByTestId('loadingIndicator'); const getAllLoadingIndicators = () => withinComponent().queryAllByTestId('loadingIndicator');
const getErrorMessage = () => withinComponent().queryByText(TEST_ERROR_MESSAGE); const getErrorMessage = () => withinComponent().queryByText(TEST_ERROR_MESSAGE);
const getErrorDetails = () => withinComponent().queryByRole('list', { name: /error details/i }); const getErrorDetails = () => withinComponent().queryByRole('list', { name: /error details/i });
const getDeleteButtonWithin = element => const getDeleteButtonWithin = (element) =>
createWrapper(within(element).queryByRole('button', { name: /delete/i })); createWrapper(within(element).queryByRole('button', { name: /delete/i }));
const getModal = () => wrapper.find(GlModal); const getModal = () => wrapper.find(GlModal);
...@@ -111,7 +111,7 @@ describe('EE - DastProfilesList', () => { ...@@ -111,7 +111,7 @@ describe('EE - DastProfilesList', () => {
}); });
describe('with existing profiles', () => { describe('with existing profiles', () => {
const getTableRowForProfile = profile => getAllTableRows()[profiles.indexOf(profile)]; const getTableRowForProfile = (profile) => getAllTableRows()[profiles.indexOf(profile)];
describe('profiles list', () => { describe('profiles list', () => {
beforeEach(() => { beforeEach(() => {
...@@ -127,7 +127,7 @@ describe('EE - DastProfilesList', () => { ...@@ -127,7 +127,7 @@ describe('EE - DastProfilesList', () => {
expect(getAllTableRows()).toHaveLength(profiles.length); expect(getAllTableRows()).toHaveLength(profiles.length);
}); });
it.each(profiles)('renders list item %# correctly', profile => { it.each(profiles)('renders list item %# correctly', (profile) => {
const [profileCell, targetUrlCell, , actionsCell] = getTableRowForProfile(profile).cells; const [profileCell, targetUrlCell, , actionsCell] = getTableRowForProfile(profile).cells;
expect(profileCell.innerText).toContain(profile.profileName); expect(profileCell.innerText).toContain(profile.profileName);
...@@ -150,7 +150,7 @@ describe('EE - DastProfilesList', () => { ...@@ -150,7 +150,7 @@ describe('EE - DastProfilesList', () => {
}, },
}); });
}); });
it.each(profiles)('renders list item %# correctly', profile => { it.each(profiles)('renders list item %# correctly', (profile) => {
const [profileCell, , , actionsCell] = getTableRowForProfile(profile).cells; const [profileCell, , , actionsCell] = getTableRowForProfile(profile).cells;
expect(profileCell.innerHTML).toContain(`<b>${profile.profileName}</b>`); expect(profileCell.innerHTML).toContain(`<b>${profile.profileName}</b>`);
...@@ -184,7 +184,7 @@ describe('EE - DastProfilesList', () => { ...@@ -184,7 +184,7 @@ describe('EE - DastProfilesList', () => {
}); });
}); });
describe.each(profiles)('delete profile', profile => { describe.each(profiles)('delete profile', (profile) => {
beforeEach(() => { beforeEach(() => {
createFullComponent({ propsData: { profiles } }); createFullComponent({ propsData: { profiles } });
}); });
......
...@@ -53,9 +53,9 @@ describe('EE - DastProfiles', () => { ...@@ -53,9 +53,9 @@ describe('EE - DastProfiles', () => {
const createFullComponent = createComponentFactory(mount); const createFullComponent = createComponentFactory(mount);
const withinComponent = () => within(wrapper.element); const withinComponent = () => within(wrapper.element);
const getProfilesComponent = profileType => wrapper.find(`[data-testid="${profileType}List"]`); const getProfilesComponent = (profileType) => wrapper.find(`[data-testid="${profileType}List"]`);
const getDropdownComponent = () => wrapper.find(GlDropdown); const getDropdownComponent = () => wrapper.find(GlDropdown);
const getSiteProfilesDropdownItem = text => const getSiteProfilesDropdownItem = (text) =>
within(getDropdownComponent().element).queryByText(text); within(getDropdownComponent().element).queryByText(text);
const getTabsComponent = () => wrapper.find(GlTabs); const getTabsComponent = () => wrapper.find(GlTabs);
const getTab = ({ tabName, selected }) => const getTab = ({ tabName, selected }) =>
......
...@@ -33,7 +33,7 @@ describe('EE - DastSiteProfileList', () => { ...@@ -33,7 +33,7 @@ describe('EE - DastSiteProfileList', () => {
isLoading: false, isLoading: false,
}; };
const createMockApolloProvider = handlers => { const createMockApolloProvider = (handlers) => {
localVue.use(VueApollo); localVue.use(VueApollo);
requestHandlers = handlers; requestHandlers = handlers;
return createApolloProvider([[dastSiteValidationsQuery, requestHandlers.dastSiteValidations]]); return createApolloProvider([[dastSiteValidationsQuery, requestHandlers.dastSiteValidations]]);
...@@ -67,7 +67,7 @@ describe('EE - DastSiteProfileList', () => { ...@@ -67,7 +67,7 @@ describe('EE - DastSiteProfileList', () => {
return tableBody; return tableBody;
}; };
const getAllTableRows = () => within(getTableBody()).getAllByRole('row'); const getAllTableRows = () => within(getTableBody()).getAllByRole('row');
const getTableRowForProfile = profile => getAllTableRows()[siteProfiles.indexOf(profile)]; const getTableRowForProfile = (profile) => getAllTableRows()[siteProfiles.indexOf(profile)];
const findProfileList = () => wrapper.find(ProfilesList); const findProfileList = () => wrapper.find(ProfilesList);
...@@ -193,7 +193,7 @@ describe('EE - DastSiteProfileList', () => { ...@@ -193,7 +193,7 @@ describe('EE - DastSiteProfileList', () => {
}); });
}); });
it.each(siteProfiles)('profile %# should not have validate button and status', profile => { it.each(siteProfiles)('profile %# should not have validate button and status', (profile) => {
const [, , validationStatusCell, actionsCell] = getTableRowForProfile(profile).cells; const [, , validationStatusCell, actionsCell] = getTableRowForProfile(profile).cells;
expect(within(actionsCell).queryByRole('button', { name: /validate/i })).toBe(null); expect(within(actionsCell).queryByRole('button', { name: /validate/i })).toBe(null);
......
...@@ -36,7 +36,7 @@ describe('DAST Scanner Profile', () => { ...@@ -36,7 +36,7 @@ describe('DAST Scanner Profile', () => {
let wrapper; let wrapper;
const withinComponent = () => within(wrapper.element); const withinComponent = () => within(wrapper.element);
const findByTestId = testId => wrapper.find(`[data-testid="${testId}"`); const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"`);
const findForm = () => wrapper.find(GlForm); const findForm = () => wrapper.find(GlForm);
const findProfileNameInput = () => findByTestId('profile-name-input'); const findProfileNameInput = () => findByTestId('profile-name-input');
...@@ -50,7 +50,7 @@ describe('DAST Scanner Profile', () => { ...@@ -50,7 +50,7 @@ describe('DAST Scanner Profile', () => {
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const submitForm = () => findForm().vm.$emit('submit', { preventDefault: () => {} }); const submitForm = () => findForm().vm.$emit('submit', { preventDefault: () => {} });
const componentFactory = (mountFn = shallowMount) => options => { const componentFactory = (mountFn = shallowMount) => (options) => {
wrapper = mountFn( wrapper = mountFn(
DastScannerProfileForm, DastScannerProfileForm,
merge( merge(
...@@ -120,7 +120,7 @@ describe('DAST Scanner Profile', () => { ...@@ -120,7 +120,7 @@ describe('DAST Scanner Profile', () => {
createFullComponent(); createFullComponent();
}); });
it.each(invalidValues)('is marked as invalid provided an invalid value', async value => { it.each(invalidValues)('is marked as invalid provided an invalid value', async (value) => {
await finder().find('input').setValue(value); await finder().find('input').setValue(value);
expect(wrapper.text()).toContain(errorMessage); expect(wrapper.text()).toContain(errorMessage);
...@@ -242,7 +242,7 @@ describe('DAST Scanner Profile', () => { ...@@ -242,7 +242,7 @@ describe('DAST Scanner Profile', () => {
const alert = findAlert(); const alert = findAlert();
expect(alert.exists()).toBe(true); expect(alert.exists()).toBe(true);
errors.forEach(error => { errors.forEach((error) => {
expect(alert.text()).toContain(error); expect(alert.text()).toContain(error);
}); });
}); });
......
...@@ -24,7 +24,7 @@ describe('DastSiteAuthSection', () => { ...@@ -24,7 +24,7 @@ describe('DastSiteAuthSection', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findByNameAttribute = name => wrapper.find(`[name="${name}"]`); const findByNameAttribute = (name) => wrapper.find(`[name="${name}"]`);
const findAuthForm = () => wrapper.findByTestId('auth-form'); const findAuthForm = () => wrapper.findByTestId('auth-form');
const findAuthCheckbox = () => wrapper.find(GlFormCheckbox); const findAuthCheckbox = () => wrapper.find(GlFormCheckbox);
...@@ -41,7 +41,7 @@ describe('DastSiteAuthSection', () => { ...@@ -41,7 +41,7 @@ describe('DastSiteAuthSection', () => {
describe('authentication toggle', () => { describe('authentication toggle', () => {
it.each([true, false])( it.each([true, false])(
'is set correctly when the "authEnabled" field is set to "%s"', 'is set correctly when the "authEnabled" field is set to "%s"',
authEnabled => { (authEnabled) => {
createComponent({ fields: { authEnabled } }); createComponent({ fields: { authEnabled } });
expect(findAuthCheckbox().vm.$attrs.checked).toBe(authEnabled); expect(findAuthCheckbox().vm.$attrs.checked).toBe(authEnabled);
}, },
...@@ -55,7 +55,7 @@ describe('DastSiteAuthSection', () => { ...@@ -55,7 +55,7 @@ describe('DastSiteAuthSection', () => {
it.each([true, false])( it.each([true, false])(
'makes the component emit an "input" event when changed', 'makes the component emit an "input" event when changed',
async enabled => { async (enabled) => {
await setAuthentication({ enabled }); await setAuthentication({ enabled });
expect(getLatestInputEventPayload().fields.authEnabled.value).toBe(enabled); expect(getLatestInputEventPayload().fields.authEnabled.value).toBe(enabled);
}, },
...@@ -77,7 +77,7 @@ describe('DastSiteAuthSection', () => { ...@@ -77,7 +77,7 @@ describe('DastSiteAuthSection', () => {
const inputFieldNames = Object.keys(inputFieldsWithValues); const inputFieldNames = Object.keys(inputFieldsWithValues);
describe.each(inputFieldNames)('input field "%s"', inputFieldName => { describe.each(inputFieldNames)('input field "%s"', (inputFieldName) => {
it('is rendered', () => { it('is rendered', () => {
expect(findByNameAttribute(inputFieldName).exists()).toBe(true); expect(findByNameAttribute(inputFieldName).exists()).toBe(true);
}); });
......
...@@ -25,7 +25,7 @@ describe('ConfigurationForm component', () => { ...@@ -25,7 +25,7 @@ describe('ConfigurationForm component', () => {
let pendingPromiseResolvers; let pendingPromiseResolvers;
const fulfillPendingPromises = () => { const fulfillPendingPromises = () => {
pendingPromiseResolvers.forEach(resolve => resolve()); pendingPromiseResolvers.forEach((resolve) => resolve());
}; };
const createComponent = ({ mutationResult, ...options } = {}) => { const createComponent = ({ mutationResult, ...options } = {}) => {
...@@ -47,7 +47,7 @@ describe('ConfigurationForm component', () => { ...@@ -47,7 +47,7 @@ describe('ConfigurationForm component', () => {
$apollo: { $apollo: {
mutate: jest.fn( mutate: jest.fn(
() => () =>
new Promise(resolve => { new Promise((resolve) => {
pendingPromiseResolvers.push(() => pendingPromiseResolvers.push(() =>
resolve({ resolve({
data: { configureSast: mutationResult }, data: { configureSast: mutationResult },
......
...@@ -34,7 +34,7 @@ describe('DynamicFields component', () => { ...@@ -34,7 +34,7 @@ describe('DynamicFields component', () => {
}); });
}); });
describe.each([true, false])('given the disabled prop is %p', disabled => { describe.each([true, false])('given the disabled prop is %p', (disabled) => {
let entities; let entities;
beforeEach(() => { beforeEach(() => {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @returns {Object[]} * @returns {Object[]}
*/ */
export const makeEntities = (count, changes) => export const makeEntities = (count, changes) =>
[...Array(count).keys()].map(i => ({ [...Array(count).keys()].map((i) => ({
defaultValue: `defaultValue${i}`, defaultValue: `defaultValue${i}`,
description: `description${i}`, description: `description${i}`,
field: `field${i}`, field: `field${i}`,
...@@ -28,7 +28,7 @@ export const makeEntities = (count, changes) => ...@@ -28,7 +28,7 @@ export const makeEntities = (count, changes) =>
* @returns {Object[]} * @returns {Object[]}
*/ */
export const makeAnalyzerEntities = (count, changes) => export const makeAnalyzerEntities = (count, changes) =>
[...Array(count).keys()].map(i => ({ [...Array(count).keys()].map((i) => ({
name: `nameValue${i}`, name: `nameValue${i}`,
label: `label${i}`, label: `label${i}`,
description: `description${i}`, description: `description${i}`,
......
...@@ -22,11 +22,11 @@ describe('isValidConfigurationEntity', () => { ...@@ -22,11 +22,11 @@ describe('isValidConfigurationEntity', () => {
...makeEntities(1, { defaultValue: undefined }), ...makeEntities(1, { defaultValue: undefined }),
]; ];
it.each(validEntities)('returns true for a valid entity', entity => { it.each(validEntities)('returns true for a valid entity', (entity) => {
expect(isValidConfigurationEntity(entity)).toBe(true); expect(isValidConfigurationEntity(entity)).toBe(true);
}); });
it.each(invalidEntities)('returns false for an invalid entity', invalidEntity => { it.each(invalidEntities)('returns false for an invalid entity', (invalidEntity) => {
expect(isValidConfigurationEntity(invalidEntity)).toBe(false); expect(isValidConfigurationEntity(invalidEntity)).toBe(false);
}); });
}); });
...@@ -45,11 +45,11 @@ describe('isValidAnalyzerEntity', () => { ...@@ -45,11 +45,11 @@ describe('isValidAnalyzerEntity', () => {
...makeAnalyzerEntities(1, { enabled: '' }), ...makeAnalyzerEntities(1, { enabled: '' }),
]; ];
it.each(validEntities)('returns true for a valid entity', entity => { it.each(validEntities)('returns true for a valid entity', (entity) => {
expect(isValidAnalyzerEntity(entity)).toBe(true); expect(isValidAnalyzerEntity(entity)).toBe(true);
}); });
it.each(invalidEntities)('returns false for an invalid entity', invalidEntity => { it.each(invalidEntities)('returns false for an invalid entity', (invalidEntity) => {
expect(isValidAnalyzerEntity(invalidEntity)).toBe(false); expect(isValidAnalyzerEntity(invalidEntity)).toBe(false);
}); });
}); });
......
...@@ -31,7 +31,7 @@ describe('AutoFix Help Text component', () => { ...@@ -31,7 +31,7 @@ describe('AutoFix Help Text component', () => {
wrapper = createWrapper(); wrapper = createWrapper();
}); });
const findByTestId = id => wrapper.find(`[data-testid="${id}"]`); const findByTestId = (id) => wrapper.find(`[data-testid="${id}"]`);
it('popover should have wrapping div as target', () => { it('popover should have wrapping div as target', () => {
expect( expect(
......
...@@ -50,7 +50,7 @@ describe('Filter Body component', () => { ...@@ -50,7 +50,7 @@ describe('Filter Body component', () => {
}); });
describe('search box', () => { describe('search box', () => {
it.each([true, false])('shows/hides search box when the showSearchBox prop is %s', show => { it.each([true, false])('shows/hides search box when the showSearchBox prop is %s', (show) => {
createComponent({ showSearchBox: show }); createComponent({ showSearchBox: show });
expect(searchBox().exists()).toBe(show); expect(searchBox().exists()).toBe(show);
......
...@@ -38,7 +38,7 @@ describe('Filter Item component', () => { ...@@ -38,7 +38,7 @@ describe('Filter Item component', () => {
}); });
}); });
it.each([true, false])('shows the expected checkmark when isSelected is %s', isChecked => { it.each([true, false])('shows the expected checkmark when isSelected is %s', (isChecked) => {
createWrapper({ isChecked }); createWrapper({ isChecked });
expect(dropdownItem().props('isChecked')).toBe(isChecked); expect(dropdownItem().props('isChecked')).toBe(isChecked);
}); });
......
...@@ -7,7 +7,7 @@ const localVue = createLocalVue(); ...@@ -7,7 +7,7 @@ const localVue = createLocalVue();
localVue.use(VueRouter); localVue.use(VueRouter);
const router = new VueRouter(); const router = new VueRouter();
const generateOptions = length => const generateOptions = (length) =>
Array.from({ length }).map((_, i) => ({ name: `Option ${i}`, id: `option-${i}`, index: i })); Array.from({ length }).map((_, i) => ({ name: `Option ${i}`, id: `option-${i}`, index: i }));
const filter = { const filter = {
...@@ -17,8 +17,8 @@ const filter = { ...@@ -17,8 +17,8 @@ const filter = {
allOption: { id: 'allOptionId' }, allOption: { id: 'allOptionId' },
defaultOptions: [], defaultOptions: [],
}; };
const optionsAt = indexes => filter.options.filter(x => indexes.includes(x.index)); const optionsAt = (indexes) => filter.options.filter((x) => indexes.includes(x.index));
const optionIdsAt = indexes => optionsAt(indexes).map(x => x.id); const optionIdsAt = (indexes) => optionsAt(indexes).map((x) => x.id);
describe('Standard Filter component', () => { describe('Standard Filter component', () => {
let wrapper; let wrapper;
...@@ -32,9 +32,9 @@ describe('Standard Filter component', () => { ...@@ -32,9 +32,9 @@ describe('Standard Filter component', () => {
}; };
const dropdownItems = () => wrapper.findAll('[data-testid="filterOption"]'); const dropdownItems = () => wrapper.findAll('[data-testid="filterOption"]');
const dropdownItemAt = index => dropdownItems().at(index); const dropdownItemAt = (index) => dropdownItems().at(index);
const allOptionItem = () => wrapper.find('[data-testid="allOption"]'); const allOptionItem = () => wrapper.find('[data-testid="allOption"]');
const isChecked = item => item.props('isChecked'); const isChecked = (item) => item.props('isChecked');
const filterQuery = () => wrapper.vm.$route.query[filter.id]; const filterQuery = () => wrapper.vm.$route.query[filter.id];
const filterBody = () => wrapper.find(FilterBody); const filterBody = () => wrapper.find(FilterBody);
...@@ -43,13 +43,13 @@ describe('Standard Filter component', () => { ...@@ -43,13 +43,13 @@ describe('Standard Filter component', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
}; };
const clickItemAt = async index => { const clickItemAt = async (index) => {
dropdownItemAt(index).vm.$emit('click'); dropdownItemAt(index).vm.$emit('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
}; };
const expectSelectedItems = indexes => { const expectSelectedItems = (indexes) => {
const checkedIndexes = dropdownItems().wrappers.map(item => isChecked(item)); const checkedIndexes = dropdownItems().wrappers.map((item) => isChecked(item));
const expectedIndexes = Array.from({ length: checkedIndexes.length }).map((_, index) => const expectedIndexes = Array.from({ length: checkedIndexes.length }).map((_, index) =>
indexes.includes(index), indexes.includes(index),
); );
...@@ -59,7 +59,7 @@ describe('Standard Filter component', () => { ...@@ -59,7 +59,7 @@ describe('Standard Filter component', () => {
const expectAllOptionSelected = () => { const expectAllOptionSelected = () => {
expect(isChecked(allOptionItem())).toBe(true); expect(isChecked(allOptionItem())).toBe(true);
const checkedIndexes = dropdownItems().wrappers.map(item => isChecked(item)); const checkedIndexes = dropdownItems().wrappers.map((item) => isChecked(item));
const expectedIndexes = new Array(checkedIndexes.length).fill(false); const expectedIndexes = new Array(checkedIndexes.length).fill(false);
expect(checkedIndexes).toEqual(expectedIndexes); expect(checkedIndexes).toEqual(expectedIndexes);
...@@ -106,13 +106,13 @@ describe('Standard Filter component', () => { ...@@ -106,13 +106,13 @@ describe('Standard Filter component', () => {
}); });
it('filters options when something is typed in the search box', async () => { it('filters options when something is typed in the search box', async () => {
const expectedItems = filter.options.map(x => x.name).filter(x => x.includes('1')); const expectedItems = filter.options.map((x) => x.name).filter((x) => x.includes('1'));
createWrapper({}, true); createWrapper({}, true);
filterBody().vm.$emit('input', '1'); filterBody().vm.$emit('input', '1');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(dropdownItems()).toHaveLength(3); expect(dropdownItems()).toHaveLength(3);
expect(dropdownItems().wrappers.map(x => x.props('text'))).toEqual(expectedItems); expect(dropdownItems().wrappers.map((x) => x.props('text'))).toEqual(expectedItems);
}); });
}); });
...@@ -177,7 +177,7 @@ describe('Standard Filter component', () => { ...@@ -177,7 +177,7 @@ describe('Standard Filter component', () => {
}); });
describe('filter querystring', () => { describe('filter querystring', () => {
const updateRouteQuery = async ids => { const updateRouteQuery = async (ids) => {
// window.history.back() won't change the location nor fire the popstate event, so we need // window.history.back() won't change the location nor fire the popstate event, so we need
// to fake it by doing it manually. // to fake it by doing it manually.
router.replace({ query: { [filter.id]: ids } }); router.replace({ query: { [filter.id]: ids } });
...@@ -190,7 +190,7 @@ describe('Standard Filter component', () => { ...@@ -190,7 +190,7 @@ describe('Standard Filter component', () => {
createWrapper(); createWrapper();
const clickedIds = []; const clickedIds = [];
[1, 3, 5].forEach(index => { [1, 3, 5].forEach((index) => {
clickItemAt(index); clickItemAt(index);
clickedIds.push(optionIdsAt([index])[0]); clickedIds.push(optionIdsAt([index])[0]);
......
...@@ -4,9 +4,9 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -4,9 +4,9 @@ import { shallowMount } from '@vue/test-utils';
import ProjectList from 'ee/security_dashboard/components/first_class_project_manager/project_list.vue'; import ProjectList from 'ee/security_dashboard/components/first_class_project_manager/project_list.vue';
import ProjectAvatar from '~/vue_shared/components/project_avatar/default.vue'; import ProjectAvatar from '~/vue_shared/components/project_avatar/default.vue';
const getArrayWithLength = n => [...Array(n).keys()]; const getArrayWithLength = (n) => [...Array(n).keys()];
const generateMockProjects = (projectsCount, mockProject = {}) => const generateMockProjects = (projectsCount, mockProject = {}) =>
getArrayWithLength(projectsCount).map(id => ({ id, ...mockProject })); getArrayWithLength(projectsCount).map((id) => ({ id, ...mockProject }));
describe('Project List component', () => { describe('Project List component', () => {
let wrapper; let wrapper;
...@@ -49,7 +49,7 @@ describe('Project List component', () => { ...@@ -49,7 +49,7 @@ describe('Project List component', () => {
it.each([0, 1, 2])( it.each([0, 1, 2])(
'renders a list of projects and displays a count of how many there are', 'renders a list of projects and displays a count of how many there are',
projectsCount => { (projectsCount) => {
factory({ projects: generateMockProjects(projectsCount) }); factory({ projects: generateMockProjects(projectsCount) });
expect(getAllProjectItems()).toHaveLength(projectsCount); expect(getAllProjectItems()).toHaveLength(projectsCount);
......
...@@ -47,7 +47,7 @@ describe('First class Project Security Dashboard component', () => { ...@@ -47,7 +47,7 @@ describe('First class Project Security Dashboard component', () => {
const findCsvExportButton = () => wrapper.find(CsvExportButton); const findCsvExportButton = () => wrapper.find(CsvExportButton);
const findAutoFixUserCallout = () => wrapper.find(AutoFixUserCallout); const findAutoFixUserCallout = () => wrapper.find(AutoFixUserCallout);
const createComponent = options => { const createComponent = (options) => {
wrapper = shallowMount(FirstClassProjectSecurityDashboard, { wrapper = shallowMount(FirstClassProjectSecurityDashboard, {
propsData: { propsData: {
...props, ...props,
......
...@@ -27,7 +27,7 @@ describe('Vulnerability Severity component', () => { ...@@ -27,7 +27,7 @@ describe('Vulnerability Severity component', () => {
const findAccordionItemsText = () => const findAccordionItemsText = () =>
wrapper wrapper
.findAll('[data-testid="vulnerability-severity-groups"]') .findAll('[data-testid="vulnerability-severity-groups"]')
.wrappers.map(item => trimText(item.text())); .wrappers.map((item) => trimText(item.text()));
const createApolloProvider = (...queries) => { const createApolloProvider = (...queries) => {
return createMockApollo([...queries]); return createMockApollo([...queries]);
...@@ -53,8 +53,8 @@ describe('Vulnerability Severity component', () => { ...@@ -53,8 +53,8 @@ describe('Vulnerability Severity component', () => {
const findHelpLink = () => wrapper.find(GlLink); const findHelpLink = () => wrapper.find(GlLink);
const findHeader = () => wrapper.find('h4'); const findHeader = () => wrapper.find('h4');
const findDescription = () => wrapper.find('p'); const findDescription = () => wrapper.find('p');
const findAccordionItemByGrade = grade => wrapper.find({ ref: `accordionItem${grade}` }); const findAccordionItemByGrade = (grade) => wrapper.find({ ref: `accordionItem${grade}` });
const findProjectName = accordion => accordion.findAll(GlLink); const findProjectName = (accordion) => accordion.findAll(GlLink);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -11,7 +11,7 @@ const illustrations = { ...@@ -11,7 +11,7 @@ const illustrations = {
describe('LoadingError component', () => { describe('LoadingError component', () => {
let wrapper; let wrapper;
const createWrapper = errorCode => { const createWrapper = (errorCode) => {
wrapper = shallowMount(LoadingError, { wrapper = shallowMount(LoadingError, {
propsData: { propsData: {
errorCode, errorCode,
...@@ -25,7 +25,7 @@ describe('LoadingError component', () => { ...@@ -25,7 +25,7 @@ describe('LoadingError component', () => {
wrapper = null; wrapper = null;
}); });
describe.each([401, 403])('with error code %s', errorCode => { describe.each([401, 403])('with error code %s', (errorCode) => {
beforeEach(() => { beforeEach(() => {
createWrapper(errorCode); createWrapper(errorCode);
}); });
......
...@@ -24,7 +24,7 @@ describe('Pipeline Security Dashboard component', () => { ...@@ -24,7 +24,7 @@ describe('Pipeline Security Dashboard component', () => {
let store; let store;
let wrapper; let wrapper;
const factory = options => { const factory = (options) => {
store = new Vuex.Store({ store = new Vuex.Store({
modules: { modules: {
vulnerabilities: { vulnerabilities: {
......
...@@ -11,7 +11,7 @@ describe('Pipeline status badge', () => { ...@@ -11,7 +11,7 @@ describe('Pipeline status badge', () => {
const findGlBadge = () => wrapper.find(GlBadge); const findGlBadge = () => wrapper.find(GlBadge);
const findGlIcon = () => wrapper.find(GlIcon); const findGlIcon = () => wrapper.find(GlIcon);
const createProps = securityBuildsFailedCount => ({ pipeline: { securityBuildsFailedCount } }); const createProps = (securityBuildsFailedCount) => ({ pipeline: { securityBuildsFailedCount } });
const createWrapper = (props = {}) => { const createWrapper = (props = {}) => {
wrapper = shallowMount(PipelineStatusBadge, { wrapper = shallowMount(PipelineStatusBadge, {
......
...@@ -15,7 +15,7 @@ describe('Security Charts Layout component', () => { ...@@ -15,7 +15,7 @@ describe('Security Charts Layout component', () => {
const findSlot = () => wrapper.find(`[data-testid="security-charts-layout"]`); const findSlot = () => wrapper.find(`[data-testid="security-charts-layout"]`);
const createWrapper = slots => { const createWrapper = (slots) => {
wrapper = shallowMount(SecurityChartsLayout, { slots }); wrapper = shallowMount(SecurityChartsLayout, { slots });
}; };
......
...@@ -11,7 +11,7 @@ describe('Security Dashboard Layout component', () => { ...@@ -11,7 +11,7 @@ describe('Security Dashboard Layout component', () => {
template: '<p>dummy component</p>', template: '<p>dummy component</p>',
}; };
const createWrapper = slots => { const createWrapper = (slots) => {
wrapper = shallowMount(SecurityDashboardLayout, { slots }); wrapper = shallowMount(SecurityDashboardLayout, { slots });
}; };
......
...@@ -35,7 +35,7 @@ describe('Security Dashboard Table Row', () => { ...@@ -35,7 +35,7 @@ describe('Security Dashboard Table Row', () => {
}); });
const findLoader = () => wrapper.find('.js-skeleton-loader'); const findLoader = () => wrapper.find('.js-skeleton-loader');
const findContent = i => wrapper.findAll('.table-mobile-content').at(i); const findContent = (i) => wrapper.findAll('.table-mobile-content').at(i);
const findAllIssueCreated = () => wrapper.findAll('[data-testid="issues-icon"]'); const findAllIssueCreated = () => wrapper.findAll('[data-testid="issues-icon"]');
const hasSelectedClass = () => wrapper.classes('gl-bg-blue-50'); const hasSelectedClass = () => wrapper.classes('gl-bg-blue-50');
const findCheckbox = () => wrapper.find(GlFormCheckbox); const findCheckbox = () => wrapper.find(GlFormCheckbox);
......
...@@ -26,7 +26,7 @@ describe('Security Dashboard component', () => { ...@@ -26,7 +26,7 @@ describe('Security Dashboard component', () => {
let fetchPipelineJobsSpy; let fetchPipelineJobsSpy;
let store; let store;
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(SecurityDashboard, { wrapper = shallowMount(SecurityDashboard, {
store, store,
stubs: { stubs: {
...@@ -141,14 +141,14 @@ describe('Security Dashboard component', () => { ...@@ -141,14 +141,14 @@ describe('Security Dashboard component', () => {
createComponent(); createComponent();
}); });
it.each([401, 403])('displays an error on error %s', errorCode => { it.each([401, 403])('displays an error on error %s', (errorCode) => {
store.dispatch('vulnerabilities/receiveVulnerabilitiesError', errorCode); store.dispatch('vulnerabilities/receiveVulnerabilitiesError', errorCode);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(LoadingError).exists()).toBe(true); expect(wrapper.find(LoadingError).exists()).toBe(true);
}); });
}); });
it.each([404, 500])('does not display an error on error %s', errorCode => { it.each([404, 500])('does not display an error on error %s', (errorCode) => {
store.dispatch('vulnerabilities/receiveVulnerabilitiesError', errorCode); store.dispatch('vulnerabilities/receiveVulnerabilitiesError', errorCode);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(LoadingError).exists()).toBe(false); expect(wrapper.find(LoadingError).exists()).toBe(false);
......
...@@ -11,7 +11,7 @@ describe('Security reports summary component', () => { ...@@ -11,7 +11,7 @@ describe('Security reports summary component', () => {
let wrapper; let wrapper;
const createWrapper = options => { const createWrapper = (options) => {
wrapper = shallowMount(SecurityReportsSummary, { wrapper = shallowMount(SecurityReportsSummary, {
propsData: { propsData: {
summary: {}, summary: {},
......
...@@ -31,7 +31,7 @@ describe('EE Vulnerability Security Scanner Alert', () => { ...@@ -31,7 +31,7 @@ describe('EE Vulnerability Security Scanner Alert', () => {
const withinWrapper = () => within(wrapper.element); const withinWrapper = () => within(wrapper.element);
const findAlert = () => withinWrapper().queryByRole('alert'); const findAlert = () => withinWrapper().queryByRole('alert');
const findById = testId => withinWrapper().getByTestId(testId); const findById = (testId) => withinWrapper().getByTestId(testId);
describe('container', () => { describe('container', () => {
it('renders when disabled scanners are detected', () => { it('renders when disabled scanners are detected', () => {
......
...@@ -88,7 +88,7 @@ describe('Selection Summary component', () => { ...@@ -88,7 +88,7 @@ describe('Selection Summary component', () => {
let mutateMock; let mutateMock;
beforeEach(() => { beforeEach(() => {
mutateMock = jest.fn(data => mutateMock = jest.fn((data) =>
data.variables.id % 2 === 0 ? Promise.resolve() : Promise.reject(), data.variables.id % 2 === 0 ? Promise.resolve() : Promise.reject(),
); );
......
...@@ -50,7 +50,7 @@ describe('Selection Summary', () => { ...@@ -50,7 +50,7 @@ describe('Selection Summary', () => {
const dismissMessage = () => wrapper.find('[data-testid="dismiss-message"]'); const dismissMessage = () => wrapper.find('[data-testid="dismiss-message"]');
const dismissButton = () => wrapper.find(GlButton); const dismissButton = () => wrapper.find(GlButton);
const selectByIndex = index => const selectByIndex = (index) =>
store.commit(`vulnerabilities/${SELECT_VULNERABILITY}`, mockDataVulnerabilities[index].id); store.commit(`vulnerabilities/${SELECT_VULNERABILITY}`, mockDataVulnerabilities[index].id);
it('renders the form', () => { it('renders the form', () => {
......
...@@ -26,7 +26,7 @@ describe('Vulnerabilities count list component', () => { ...@@ -26,7 +26,7 @@ describe('Vulnerabilities count list component', () => {
it('passes the isLoading prop to the counts', () => { it('passes the isLoading prop to the counts', () => {
wrapper = createWrapper({ propsData: { isLoading: true, vulnerabilitiesCount: {} } }); wrapper = createWrapper({ propsData: { isLoading: true, vulnerabilitiesCount: {} } });
findVulnerability().wrappers.forEach(component => { findVulnerability().wrappers.forEach((component) => {
expect(component.props('isLoading')).toBe(true); expect(component.props('isLoading')).toBe(true);
}); });
}); });
...@@ -60,7 +60,7 @@ describe('Vulnerabilities count list component', () => { ...@@ -60,7 +60,7 @@ describe('Vulnerabilities count list component', () => {
}); });
it('sets the isLoading prop false and passes it down', () => { it('sets the isLoading prop false and passes it down', () => {
findVulnerability().wrappers.forEach(component => { findVulnerability().wrappers.forEach((component) => {
expect(component.props('isLoading')).toBe(false); expect(component.props('isLoading')).toBe(false);
}); });
}); });
......
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