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
ee/spec/frontend/roadmap/components/epics_list_empty_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
ee/spec/frontend/security_dashboard/helpers.js
ee/spec/frontend/security_dashboard/helpers_spec.js
......
......@@ -43,7 +43,7 @@ describe('MonthsHeaderSubItemComponent', () => {
vm = createComponent({});
expect(Array.isArray(vm.headerSubItems)).toBe(true);
vm.headerSubItems.forEach(subItem => {
vm.headerSubItems.forEach((subItem) => {
expect(subItem instanceof Date).toBe(true);
});
});
......
......@@ -76,7 +76,7 @@ describe('QuartersHeaderItemComponent', () => {
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({
timeframeItem: mockTimeframeQuarters[1],
});
......
......@@ -59,7 +59,7 @@ describe('QuartersHeaderSubItemComponent', () => {
vm = createComponent({});
expect(Array.isArray(vm.headerSubItems)).toBe(true);
vm.headerSubItems.forEach(subItem => {
vm.headerSubItems.forEach((subItem) => {
expect(subItem instanceof Date).toBe(true);
});
});
......
......@@ -44,7 +44,7 @@ describe('MonthsHeaderSubItemComponent', () => {
expect(Array.isArray(vm.headerSubItems)).toBe(true);
expect(vm.headerSubItems).toHaveLength(7);
vm.headerSubItems.forEach(subItem => {
vm.headerSubItems.forEach((subItem) => {
expect(subItem instanceof Date).toBe(true);
});
});
......
......@@ -332,7 +332,7 @@ describe('Roadmap Vuex Actions', () => {
describe('refreshEpicDates', () => {
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(
epic,
state.timeframeStartDate,
......@@ -747,7 +747,7 @@ describe('Roadmap Vuex Actions', () => {
describe('refreshMilestoneDates', () => {
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(
milestone,
state.timeframeStartDate,
......
......@@ -11,7 +11,7 @@ import {
mockEpic,
} from 'ee_jest/roadmap/mock_data';
const setEpicMockData = state => {
const setEpicMockData = (state) => {
state.epics = [mockEpic];
state.childrenFlags = { 'gid://gitlab/Epic/1': {} };
state.epicIds = ['gid://gitlab/Epic/1'];
......@@ -157,7 +157,7 @@ describe('Roadmap Store Mutations', () => {
mutations[types.INIT_EPIC_CHILDREN_FLAGS](state, { epics });
epics.forEach(item => {
epics.forEach((item) => {
expect(state.childrenFlags[item.id]).toMatchObject({
itemExpanded: false,
itemChildrenFetchInProgress: false,
......
......@@ -15,7 +15,7 @@ describe('DirtyFormChecker', () => {
});
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).not.toContain('authenticity_token');
......
......@@ -31,7 +31,7 @@ describe('SamlSettingsForm', () => {
});
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.updateView();
......@@ -41,15 +41,15 @@ describe('SamlSettingsForm', () => {
});
it('correctly disables dependent toggle', () => {
samlSettingsForm.settings.forEach(s => {
samlSettingsForm.settings.forEach((s) => {
const { input } = s;
input.value = true;
});
const findEnforcedGroupManagedAccountSetting = () =>
samlSettingsForm.settings.find(s => s.name === 'enforced-group-managed-accounts');
samlSettingsForm.settings.find((s) => s.name === 'enforced-group-managed-accounts');
const findProhibitForksSetting = () =>
samlSettingsForm.settings.find(s => s.name === 'prohibited-outer-forks');
samlSettingsForm.settings.find((s) => s.name === 'prohibited-outer-forks');
samlSettingsForm.updateSAMLSettings();
samlSettingsForm.updateView();
......@@ -66,7 +66,7 @@ describe('SamlSettingsForm', () => {
});
it('correctly disables multiple dependent toggles', () => {
samlSettingsForm.settings.forEach(s => {
samlSettingsForm.settings.forEach((s) => {
const { input } = s;
input.value = true;
});
......@@ -77,8 +77,8 @@ describe('SamlSettingsForm', () => {
samlSettingsForm.updateSAMLSettings();
samlSettingsForm.updateView();
[groupSamlSetting, ...otherSettings] = samlSettingsForm.settings;
expect(samlSettingsForm.settings.every(s => s.value)).toBe(true);
expect(samlSettingsForm.settings.some(s => s.toggle.hasAttribute('disabled'))).toBe(false);
expect(samlSettingsForm.settings.every((s) => s.value)).toBe(true);
expect(samlSettingsForm.settings.some((s) => s.toggle.hasAttribute('disabled'))).toBe(false);
groupSamlSetting.input.value = false;
samlSettingsForm.updateSAMLSettings();
......@@ -86,8 +86,8 @@ describe('SamlSettingsForm', () => {
return new Promise(window.requestAnimationFrame).then(() => {
[groupSamlSetting, ...otherSettings] = samlSettingsForm.settings;
expect(otherSettings.every(s => s.value)).toBe(true);
expect(otherSettings.every(s => s.toggle.hasAttribute('disabled'))).toBe(true);
expect(otherSettings.every((s) => s.value)).toBe(true);
expect(otherSettings.every((s) => s.toggle.hasAttribute('disabled'))).toBe(true);
});
});
});
......@@ -42,7 +42,7 @@ describe('SCIMTokenToggleArea', () => {
});
describe('generateSCIMToken', () => {
it('toggles the generate and scim token forms', done => {
it('toggles the generate and scim token forms', (done) => {
scimTokenToggleArea
.generateSCIMToken()
.then(() => {
......@@ -53,7 +53,7 @@ describe('SCIMTokenToggleArea', () => {
.catch(done.fail);
});
it('populates the scim form with the token data', done => {
it('populates the scim form with the token data', (done) => {
scimTokenToggleArea
.generateSCIMToken()
.then(() => {
......@@ -74,7 +74,7 @@ describe('SCIMTokenToggleArea', () => {
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);
scimTokenToggleArea
......
......@@ -55,7 +55,7 @@ describe('Security Configuration App', () => {
const getFeaturesTable = () => wrapper.find({ ref: 'securityControlTable' });
const getFeaturesRows = () => getFeaturesTable().findAll('tbody tr');
const getAlert = () => wrapper.find(GlAlert);
const getRowCells = row => {
const getRowCells = (row) => {
const [feature, status, manage] = row.findAll('td').wrappers;
return { feature, status, manage };
};
......
......@@ -9,7 +9,7 @@ describe('FeatureStatus component', () => {
let wrapper;
let feature;
const createComponent = options => {
const createComponent = (options) => {
wrapper = shallowMount(FeatureStatus, options);
};
......
export const generateFeatures = (n, overrides = {}) => {
return [...Array(n).keys()].map(i => ({
return [...Array(n).keys()].map((i) => ({
type: `scan-type-${i}`,
name: `name-feature-${i}`,
description: `description-feature-${i}`,
......
......@@ -10,7 +10,7 @@ describe('ManageFeature component', () => {
let wrapper;
let feature;
const createComponent = options => {
const createComponent = (options) => {
wrapper = shallowMount(
ManageFeature,
merge(
......@@ -30,7 +30,7 @@ describe('ManageFeature component', () => {
});
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', () => {
const featureFlagEnabled = {
......
......@@ -56,7 +56,7 @@ describe('EE - DastProfilesList', () => {
const getAllLoadingIndicators = () => withinComponent().queryAllByTestId('loadingIndicator');
const getErrorMessage = () => withinComponent().queryByText(TEST_ERROR_MESSAGE);
const getErrorDetails = () => withinComponent().queryByRole('list', { name: /error details/i });
const getDeleteButtonWithin = element =>
const getDeleteButtonWithin = (element) =>
createWrapper(within(element).queryByRole('button', { name: /delete/i }));
const getModal = () => wrapper.find(GlModal);
......@@ -111,7 +111,7 @@ describe('EE - DastProfilesList', () => {
});
describe('with existing profiles', () => {
const getTableRowForProfile = profile => getAllTableRows()[profiles.indexOf(profile)];
const getTableRowForProfile = (profile) => getAllTableRows()[profiles.indexOf(profile)];
describe('profiles list', () => {
beforeEach(() => {
......@@ -127,7 +127,7 @@ describe('EE - DastProfilesList', () => {
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;
expect(profileCell.innerText).toContain(profile.profileName);
......@@ -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;
expect(profileCell.innerHTML).toContain(`<b>${profile.profileName}</b>`);
......@@ -184,7 +184,7 @@ describe('EE - DastProfilesList', () => {
});
});
describe.each(profiles)('delete profile', profile => {
describe.each(profiles)('delete profile', (profile) => {
beforeEach(() => {
createFullComponent({ propsData: { profiles } });
});
......
......@@ -53,9 +53,9 @@ describe('EE - DastProfiles', () => {
const createFullComponent = createComponentFactory(mount);
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 getSiteProfilesDropdownItem = text =>
const getSiteProfilesDropdownItem = (text) =>
within(getDropdownComponent().element).queryByText(text);
const getTabsComponent = () => wrapper.find(GlTabs);
const getTab = ({ tabName, selected }) =>
......
......@@ -33,7 +33,7 @@ describe('EE - DastSiteProfileList', () => {
isLoading: false,
};
const createMockApolloProvider = handlers => {
const createMockApolloProvider = (handlers) => {
localVue.use(VueApollo);
requestHandlers = handlers;
return createApolloProvider([[dastSiteValidationsQuery, requestHandlers.dastSiteValidations]]);
......@@ -67,7 +67,7 @@ describe('EE - DastSiteProfileList', () => {
return tableBody;
};
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);
......@@ -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;
expect(within(actionsCell).queryByRole('button', { name: /validate/i })).toBe(null);
......
......@@ -36,7 +36,7 @@ describe('DAST Scanner Profile', () => {
let wrapper;
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 findProfileNameInput = () => findByTestId('profile-name-input');
......@@ -50,7 +50,7 @@ describe('DAST Scanner Profile', () => {
const findAlert = () => wrapper.find(GlAlert);
const submitForm = () => findForm().vm.$emit('submit', { preventDefault: () => {} });
const componentFactory = (mountFn = shallowMount) => options => {
const componentFactory = (mountFn = shallowMount) => (options) => {
wrapper = mountFn(
DastScannerProfileForm,
merge(
......@@ -120,7 +120,7 @@ describe('DAST Scanner Profile', () => {
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);
expect(wrapper.text()).toContain(errorMessage);
......@@ -242,7 +242,7 @@ describe('DAST Scanner Profile', () => {
const alert = findAlert();
expect(alert.exists()).toBe(true);
errors.forEach(error => {
errors.forEach((error) => {
expect(alert.text()).toContain(error);
});
});
......
......@@ -24,7 +24,7 @@ describe('DastSiteAuthSection', () => {
wrapper.destroy();
});
const findByNameAttribute = name => wrapper.find(`[name="${name}"]`);
const findByNameAttribute = (name) => wrapper.find(`[name="${name}"]`);
const findAuthForm = () => wrapper.findByTestId('auth-form');
const findAuthCheckbox = () => wrapper.find(GlFormCheckbox);
......@@ -41,7 +41,7 @@ describe('DastSiteAuthSection', () => {
describe('authentication toggle', () => {
it.each([true, false])(
'is set correctly when the "authEnabled" field is set to "%s"',
authEnabled => {
(authEnabled) => {
createComponent({ fields: { authEnabled } });
expect(findAuthCheckbox().vm.$attrs.checked).toBe(authEnabled);
},
......@@ -55,7 +55,7 @@ describe('DastSiteAuthSection', () => {
it.each([true, false])(
'makes the component emit an "input" event when changed',
async enabled => {
async (enabled) => {
await setAuthentication({ enabled });
expect(getLatestInputEventPayload().fields.authEnabled.value).toBe(enabled);
},
......@@ -77,7 +77,7 @@ describe('DastSiteAuthSection', () => {
const inputFieldNames = Object.keys(inputFieldsWithValues);
describe.each(inputFieldNames)('input field "%s"', inputFieldName => {
describe.each(inputFieldNames)('input field "%s"', (inputFieldName) => {
it('is rendered', () => {
expect(findByNameAttribute(inputFieldName).exists()).toBe(true);
});
......
......@@ -25,7 +25,7 @@ describe('ConfigurationForm component', () => {
let pendingPromiseResolvers;
const fulfillPendingPromises = () => {
pendingPromiseResolvers.forEach(resolve => resolve());
pendingPromiseResolvers.forEach((resolve) => resolve());
};
const createComponent = ({ mutationResult, ...options } = {}) => {
......@@ -47,7 +47,7 @@ describe('ConfigurationForm component', () => {
$apollo: {
mutate: jest.fn(
() =>
new Promise(resolve => {
new Promise((resolve) => {
pendingPromiseResolvers.push(() =>
resolve({
data: { configureSast: mutationResult },
......
......@@ -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;
beforeEach(() => {
......
......@@ -8,7 +8,7 @@
* @returns {Object[]}
*/
export const makeEntities = (count, changes) =>
[...Array(count).keys()].map(i => ({
[...Array(count).keys()].map((i) => ({
defaultValue: `defaultValue${i}`,
description: `description${i}`,
field: `field${i}`,
......@@ -28,7 +28,7 @@ export const makeEntities = (count, changes) =>
* @returns {Object[]}
*/
export const makeAnalyzerEntities = (count, changes) =>
[...Array(count).keys()].map(i => ({
[...Array(count).keys()].map((i) => ({
name: `nameValue${i}`,
label: `label${i}`,
description: `description${i}`,
......
......@@ -22,11 +22,11 @@ describe('isValidConfigurationEntity', () => {
...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);
});
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);
});
});
......@@ -45,11 +45,11 @@ describe('isValidAnalyzerEntity', () => {
...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);
});
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);
});
});
......
......@@ -31,7 +31,7 @@ describe('AutoFix Help Text component', () => {
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', () => {
expect(
......
......@@ -50,7 +50,7 @@ describe('Filter Body component', () => {
});
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 });
expect(searchBox().exists()).toBe(show);
......
......@@ -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 });
expect(dropdownItem().props('isChecked')).toBe(isChecked);
});
......
......@@ -7,7 +7,7 @@ const localVue = createLocalVue();
localVue.use(VueRouter);
const router = new VueRouter();
const generateOptions = length =>
const generateOptions = (length) =>
Array.from({ length }).map((_, i) => ({ name: `Option ${i}`, id: `option-${i}`, index: i }));
const filter = {
......@@ -17,8 +17,8 @@ const filter = {
allOption: { id: 'allOptionId' },
defaultOptions: [],
};
const optionsAt = indexes => filter.options.filter(x => indexes.includes(x.index));
const optionIdsAt = indexes => optionsAt(indexes).map(x => x.id);
const optionsAt = (indexes) => filter.options.filter((x) => indexes.includes(x.index));
const optionIdsAt = (indexes) => optionsAt(indexes).map((x) => x.id);
describe('Standard Filter component', () => {
let wrapper;
......@@ -32,9 +32,9 @@ describe('Standard Filter component', () => {
};
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 isChecked = item => item.props('isChecked');
const isChecked = (item) => item.props('isChecked');
const filterQuery = () => wrapper.vm.$route.query[filter.id];
const filterBody = () => wrapper.find(FilterBody);
......@@ -43,13 +43,13 @@ describe('Standard Filter component', () => {
await wrapper.vm.$nextTick();
};
const clickItemAt = async index => {
const clickItemAt = async (index) => {
dropdownItemAt(index).vm.$emit('click');
await wrapper.vm.$nextTick();
};
const expectSelectedItems = indexes => {
const checkedIndexes = dropdownItems().wrappers.map(item => isChecked(item));
const expectSelectedItems = (indexes) => {
const checkedIndexes = dropdownItems().wrappers.map((item) => isChecked(item));
const expectedIndexes = Array.from({ length: checkedIndexes.length }).map((_, index) =>
indexes.includes(index),
);
......@@ -59,7 +59,7 @@ describe('Standard Filter component', () => {
const expectAllOptionSelected = () => {
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);
expect(checkedIndexes).toEqual(expectedIndexes);
......@@ -106,13 +106,13 @@ describe('Standard Filter component', () => {
});
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);
filterBody().vm.$emit('input', '1');
await wrapper.vm.$nextTick();
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', () => {
});
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
// to fake it by doing it manually.
router.replace({ query: { [filter.id]: ids } });
......@@ -190,7 +190,7 @@ describe('Standard Filter component', () => {
createWrapper();
const clickedIds = [];
[1, 3, 5].forEach(index => {
[1, 3, 5].forEach((index) => {
clickItemAt(index);
clickedIds.push(optionIdsAt([index])[0]);
......
......@@ -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 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 = {}) =>
getArrayWithLength(projectsCount).map(id => ({ id, ...mockProject }));
getArrayWithLength(projectsCount).map((id) => ({ id, ...mockProject }));
describe('Project List component', () => {
let wrapper;
......@@ -49,7 +49,7 @@ describe('Project List component', () => {
it.each([0, 1, 2])(
'renders a list of projects and displays a count of how many there are',
projectsCount => {
(projectsCount) => {
factory({ projects: generateMockProjects(projectsCount) });
expect(getAllProjectItems()).toHaveLength(projectsCount);
......
......@@ -47,7 +47,7 @@ describe('First class Project Security Dashboard component', () => {
const findCsvExportButton = () => wrapper.find(CsvExportButton);
const findAutoFixUserCallout = () => wrapper.find(AutoFixUserCallout);
const createComponent = options => {
const createComponent = (options) => {
wrapper = shallowMount(FirstClassProjectSecurityDashboard, {
propsData: {
...props,
......
......@@ -27,7 +27,7 @@ describe('Vulnerability Severity component', () => {
const findAccordionItemsText = () =>
wrapper
.findAll('[data-testid="vulnerability-severity-groups"]')
.wrappers.map(item => trimText(item.text()));
.wrappers.map((item) => trimText(item.text()));
const createApolloProvider = (...queries) => {
return createMockApollo([...queries]);
......@@ -53,8 +53,8 @@ describe('Vulnerability Severity component', () => {
const findHelpLink = () => wrapper.find(GlLink);
const findHeader = () => wrapper.find('h4');
const findDescription = () => wrapper.find('p');
const findAccordionItemByGrade = grade => wrapper.find({ ref: `accordionItem${grade}` });
const findProjectName = accordion => accordion.findAll(GlLink);
const findAccordionItemByGrade = (grade) => wrapper.find({ ref: `accordionItem${grade}` });
const findProjectName = (accordion) => accordion.findAll(GlLink);
afterEach(() => {
wrapper.destroy();
......
......@@ -11,7 +11,7 @@ const illustrations = {
describe('LoadingError component', () => {
let wrapper;
const createWrapper = errorCode => {
const createWrapper = (errorCode) => {
wrapper = shallowMount(LoadingError, {
propsData: {
errorCode,
......@@ -25,7 +25,7 @@ describe('LoadingError component', () => {
wrapper = null;
});
describe.each([401, 403])('with error code %s', errorCode => {
describe.each([401, 403])('with error code %s', (errorCode) => {
beforeEach(() => {
createWrapper(errorCode);
});
......
......@@ -24,7 +24,7 @@ describe('Pipeline Security Dashboard component', () => {
let store;
let wrapper;
const factory = options => {
const factory = (options) => {
store = new Vuex.Store({
modules: {
vulnerabilities: {
......
......@@ -11,7 +11,7 @@ describe('Pipeline status badge', () => {
const findGlBadge = () => wrapper.find(GlBadge);
const findGlIcon = () => wrapper.find(GlIcon);
const createProps = securityBuildsFailedCount => ({ pipeline: { securityBuildsFailedCount } });
const createProps = (securityBuildsFailedCount) => ({ pipeline: { securityBuildsFailedCount } });
const createWrapper = (props = {}) => {
wrapper = shallowMount(PipelineStatusBadge, {
......
......@@ -15,7 +15,7 @@ describe('Security Charts Layout component', () => {
const findSlot = () => wrapper.find(`[data-testid="security-charts-layout"]`);
const createWrapper = slots => {
const createWrapper = (slots) => {
wrapper = shallowMount(SecurityChartsLayout, { slots });
};
......
......@@ -11,7 +11,7 @@ describe('Security Dashboard Layout component', () => {
template: '<p>dummy component</p>',
};
const createWrapper = slots => {
const createWrapper = (slots) => {
wrapper = shallowMount(SecurityDashboardLayout, { slots });
};
......
......@@ -35,7 +35,7 @@ describe('Security Dashboard Table Row', () => {
});
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 hasSelectedClass = () => wrapper.classes('gl-bg-blue-50');
const findCheckbox = () => wrapper.find(GlFormCheckbox);
......
......@@ -26,7 +26,7 @@ describe('Security Dashboard component', () => {
let fetchPipelineJobsSpy;
let store;
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(SecurityDashboard, {
store,
stubs: {
......@@ -141,14 +141,14 @@ describe('Security Dashboard component', () => {
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);
return wrapper.vm.$nextTick().then(() => {
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);
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(LoadingError).exists()).toBe(false);
......
......@@ -11,7 +11,7 @@ describe('Security reports summary component', () => {
let wrapper;
const createWrapper = options => {
const createWrapper = (options) => {
wrapper = shallowMount(SecurityReportsSummary, {
propsData: {
summary: {},
......
......@@ -31,7 +31,7 @@ describe('EE Vulnerability Security Scanner Alert', () => {
const withinWrapper = () => within(wrapper.element);
const findAlert = () => withinWrapper().queryByRole('alert');
const findById = testId => withinWrapper().getByTestId(testId);
const findById = (testId) => withinWrapper().getByTestId(testId);
describe('container', () => {
it('renders when disabled scanners are detected', () => {
......
......@@ -88,7 +88,7 @@ describe('Selection Summary component', () => {
let mutateMock;
beforeEach(() => {
mutateMock = jest.fn(data =>
mutateMock = jest.fn((data) =>
data.variables.id % 2 === 0 ? Promise.resolve() : Promise.reject(),
);
......
......@@ -50,7 +50,7 @@ describe('Selection Summary', () => {
const dismissMessage = () => wrapper.find('[data-testid="dismiss-message"]');
const dismissButton = () => wrapper.find(GlButton);
const selectByIndex = index =>
const selectByIndex = (index) =>
store.commit(`vulnerabilities/${SELECT_VULNERABILITY}`, mockDataVulnerabilities[index].id);
it('renders the form', () => {
......
......@@ -26,7 +26,7 @@ describe('Vulnerabilities count list component', () => {
it('passes the isLoading prop to the counts', () => {
wrapper = createWrapper({ propsData: { isLoading: true, vulnerabilitiesCount: {} } });
findVulnerability().wrappers.forEach(component => {
findVulnerability().wrappers.forEach((component) => {
expect(component.props('isLoading')).toBe(true);
});
});
......@@ -60,7 +60,7 @@ describe('Vulnerabilities count list component', () => {
});
it('sets the isLoading prop false and passes it down', () => {
findVulnerability().wrappers.forEach(component => {
findVulnerability().wrappers.forEach((component) => {
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