Commit 94cfbb0c authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 37 files - 67 of 73

Part of our prettier migration; changing the arrow-parens style.
parent b69f448f
......@@ -7,7 +7,7 @@ import LegacyContainer from '~/projects/experiment_new_project_creation/componen
describe('Experimental new project creation app', () => {
let wrapper;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = shallowMount(App, { propsData });
};
......
......@@ -6,7 +6,7 @@ describe('Legacy container component', () => {
let wrapper;
let dummy;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = shallowMount(LegacyContainer, { propsData });
};
......
......@@ -6,7 +6,7 @@ describe('Welcome page', () => {
let wrapper;
let trackingSpy;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = shallowMount(WelcomePage, { propsData });
};
......
......@@ -4,7 +4,7 @@ describe('Import Gitlab project', () => {
const pathName = 'my-project';
const projectName = 'My Project';
const setTestFixtures = url => {
const setTestFixtures = (url) => {
window.history.pushState({}, null, url);
setFixtures(`
......
......@@ -72,7 +72,7 @@ describe('AccessDropdown', () => {
describe('with only role', () => {
beforeEach(() => {
dropdown.setSelectedItems(dummyItems.filter(item => item.type === LEVEL_TYPES.ROLE));
dropdown.setSelectedItems(dummyItems.filter((item) => item.type === LEVEL_TYPES.ROLE));
$dropdownToggleText.addClass('is-default');
});
......@@ -86,7 +86,7 @@ describe('AccessDropdown', () => {
describe('with only users', () => {
beforeEach(() => {
dropdown.setSelectedItems(dummyItems.filter(item => item.type === LEVEL_TYPES.USER));
dropdown.setSelectedItems(dummyItems.filter((item) => item.type === LEVEL_TYPES.USER));
$dropdownToggleText.addClass('is-default');
});
......@@ -100,7 +100,7 @@ describe('AccessDropdown', () => {
describe('with only groups', () => {
beforeEach(() => {
dropdown.setSelectedItems(dummyItems.filter(item => item.type === LEVEL_TYPES.GROUP));
dropdown.setSelectedItems(dummyItems.filter((item) => item.type === LEVEL_TYPES.GROUP));
$dropdownToggleText.addClass('is-default');
});
......@@ -115,7 +115,7 @@ describe('AccessDropdown', () => {
describe('with users and groups', () => {
beforeEach(() => {
const selectedTypes = [LEVEL_TYPES.GROUP, LEVEL_TYPES.USER];
dropdown.setSelectedItems(dummyItems.filter(item => selectedTypes.includes(item.type)));
dropdown.setSelectedItems(dummyItems.filter((item) => selectedTypes.includes(item.type)));
$dropdownToggleText.addClass('is-default');
});
......@@ -130,7 +130,7 @@ describe('AccessDropdown', () => {
describe('with users and deploy keys', () => {
beforeEach(() => {
const selectedTypes = [LEVEL_TYPES.DEPLOY_KEY, LEVEL_TYPES.USER];
dropdown.setSelectedItems(dummyItems.filter(item => selectedTypes.includes(item.type)));
dropdown.setSelectedItems(dummyItems.filter((item) => selectedTypes.includes(item.type)));
$dropdownToggleText.addClass('is-default');
});
......
......@@ -23,7 +23,7 @@ describe('ServiceDeskService', () => {
it('makes a request to set service desk', () => {
axiosMock.onPut(endpoint).replyOnce(httpStatusCodes.OK, dummyResponse);
return service.toggleServiceDesk(true).then(response => {
return service.toggleServiceDesk(true).then((response) => {
expect(response.data).toEqual(dummyResponse);
});
});
......@@ -31,7 +31,7 @@ describe('ServiceDeskService', () => {
it('fails on error response', () => {
axiosMock.onPut(endpoint).networkError();
return service.toggleServiceDesk(true).catch(error => {
return service.toggleServiceDesk(true).catch((error) => {
expect(error.message).toBe(errorMessage);
});
});
......@@ -63,7 +63,7 @@ describe('ServiceDeskService', () => {
},
true,
)
.then(response => {
.then((response) => {
expect(response.data).toEqual(dummyResponse);
});
});
......@@ -79,7 +79,7 @@ describe('ServiceDeskService', () => {
},
true,
)
.catch(error => {
.catch((error) => {
expect(error.message).toBe(errorMessage);
});
});
......
......@@ -133,7 +133,7 @@ describe('PrometheusMetrics', () => {
mock.restore();
});
it('should show loader animation while response is being loaded and hide it when request is complete', done => {
it('should show loader animation while response is being loaded and hide it when request is complete', (done) => {
mockSuccess();
prometheusMetrics.loadActiveMetrics();
......@@ -147,7 +147,7 @@ describe('PrometheusMetrics', () => {
});
});
it('should show empty state if response failed to load', done => {
it('should show empty state if response failed to load', (done) => {
mockError();
prometheusMetrics.loadActiveMetrics();
......@@ -159,7 +159,7 @@ describe('PrometheusMetrics', () => {
});
});
it('should populate metrics list once response is loaded', done => {
it('should populate metrics list once response is loaded', (done) => {
jest.spyOn(prometheusMetrics, 'populateActiveMetrics').mockImplementation();
mockSuccess();
......
......@@ -37,7 +37,7 @@ describe('Ref selector component', () => {
attrs,
listeners: {
// simulate a parent component v-model binding
input: selectedRef => {
input: (selectedRef) => {
wrapper.setProps({ value: selectedRef });
},
},
......@@ -61,13 +61,13 @@ describe('Ref selector component', () => {
mock
.onGet(`/api/v4/projects/${projectId}/repository/branches`)
.reply(config => branchesApiCallSpy(config));
.reply((config) => branchesApiCallSpy(config));
mock
.onGet(`/api/v4/projects/${projectId}/repository/tags`)
.reply(config => tagsApiCallSpy(config));
.reply((config) => tagsApiCallSpy(config));
mock
.onGet(new RegExp(`/api/v4/projects/${projectId}/repository/commits/.*`))
.reply(config => commitApiCallSpy(config));
.reply((config) => commitApiCallSpy(config));
});
afterEach(() => {
......@@ -122,7 +122,7 @@ describe('Ref selector component', () => {
//
// Convenience methods
//
const updateQuery = newQuery => {
const updateQuery = (newQuery) => {
findSearchBox().vm.$emit('input', newQuery);
};
......@@ -334,7 +334,7 @@ describe('Ref selector component', () => {
it('renders the default branch as a selectable item with a "default" badge', () => {
const dropdownItems = findBranchDropdownItems();
const defaultBranch = fixtures.branches.find(b => b.default);
const defaultBranch = fixtures.branches.find((b) => b.default);
const defaultBranchIndex = fixtures.branches.indexOf(defaultBranch);
expect(trimText(dropdownItems.at(defaultBranchIndex).text())).toBe(
......
......@@ -13,7 +13,7 @@ describe('delete_button', () => {
const findButton = () => wrapper.find(GlButton);
const mountComponent = props => {
const mountComponent = (props) => {
wrapper = shallowMount(component, {
propsData: {
...defaultProps,
......
......@@ -15,7 +15,7 @@ describe('Delete alert', () => {
const findAlert = () => wrapper.find(GlAlert);
const findLink = () => wrapper.find(GlLink);
const mountComponent = propsData => {
const mountComponent = (propsData) => {
wrapper = shallowMount(component, { stubs: { GlSprintf }, propsData });
};
......
......@@ -13,7 +13,7 @@ describe('Delete Modal', () => {
const findModal = () => wrapper.find(GlModal);
const findDescription = () => wrapper.find('[data-testid="description"]');
const mountComponent = propsData => {
const mountComponent = (propsData) => {
wrapper = shallowMount(component, {
propsData,
stubs: {
......
......@@ -8,7 +8,7 @@ import { tagsMock } from '../../mock_data';
describe('Tags List', () => {
let wrapper;
const tags = [...tagsMock];
const readOnlyTags = tags.map(t => ({ ...t, canDelete: false }));
const readOnlyTags = tags.map((t) => ({ ...t, canDelete: false }));
const findTagsListRow = () => wrapper.findAll(TagsListRow);
const findDeleteButton = () => wrapper.find(GlButton);
......
......@@ -28,7 +28,7 @@ describe('Image List Row', () => {
const findClipboardButton = () => wrapper.find(ClipboardButton);
const findWarningIcon = () => wrapper.find('[data-testid="warning-icon"]');
const mountComponent = props => {
const mountComponent = (props) => {
wrapper = shallowMount(Component, {
stubs: {
RouterLink,
......
......@@ -37,7 +37,7 @@ describe('Registry Breadcrumb', () => {
const findChildRoute = () => wrapper.find({ ref: 'childRouteLink' });
const findLastCrumb = () => wrapper.find({ ref: 'lastCrumb' });
const mountComponent = $route => {
const mountComponent = ($route) => {
wrapper = shallowMount(component, {
propsData: {
crumbs,
......
......@@ -158,7 +158,7 @@ export const tagsMock = [
},
];
export const graphQLImageDetailsMock = override => ({
export const graphQLImageDetailsMock = (override) => ({
data: {
containerRepository: {
...containerRepositoryMock,
......
......@@ -46,7 +46,7 @@ describe('Details Page', () => {
updateName: jest.fn(),
};
const cleanTags = tagsMock.map(t => {
const cleanTags = tagsMock.map((t) => {
const result = { ...t };
// eslint-disable-next-line no-underscore-dangle
delete result.__typename;
......@@ -58,7 +58,7 @@ describe('Details Page', () => {
await wrapper.vm.$nextTick();
};
const tagsArrayToSelectedTags = tags =>
const tagsArrayToSelectedTags = (tags) =>
tags.reduce((acc, c) => {
acc[c.name] = true;
return acc;
......@@ -334,7 +334,7 @@ describe('Details Page', () => {
findDeleteModal().vm.$emit('confirmDelete');
expect(mutationResolver).toHaveBeenCalledWith(
expect.objectContaining({ tagNames: tagsMock.map(t => t.name) }),
expect.objectContaining({ tagNames: tagsMock.map((t) => t.name) }),
);
});
});
......
......@@ -281,7 +281,7 @@ describe('List Page', () => {
const updatedImage = findImageList()
.props('images')
.find(i => i.id === deletedContainerRepository.id);
.find((i) => i.id === deletedContainerRepository.id);
expect(updatedImage.status).toBe(deletedContainerRepository.status);
});
......@@ -418,7 +418,7 @@ describe('List Page', () => {
mountComponent();
});
const testTrackingCall = action => {
const testTrackingCall = (action) => {
expect(Tracking.event).toHaveBeenCalledWith(undefined, action, {
label: 'registry_repository_delete',
});
......
......@@ -18,7 +18,7 @@ describe('ExpirationDropdown', () => {
const findFormGroup = () => wrapper.find(GlFormGroup);
const findOptions = () => wrapper.findAll('[data-testid="option"]');
const mountComponent = props => {
const mountComponent = (props) => {
wrapper = shallowMount(component, {
stubs: {
GlFormGroup,
......
......@@ -22,7 +22,7 @@ describe('ExpirationInput', () => {
const findDescription = () => wrapper.find('[data-testid="description"]');
const findDescriptionLink = () => wrapper.find(GlLink);
const mountComponent = props => {
const mountComponent = (props) => {
wrapper = shallowMount(component, {
stubs: {
GlSprintf,
......
......@@ -11,7 +11,7 @@ describe('ExpirationToggle', () => {
const findInput = () => wrapper.find(GlFormInput);
const findFormGroup = () => wrapper.find(GlFormGroup);
const mountComponent = propsData => {
const mountComponent = (propsData) => {
wrapper = shallowMount(component, {
stubs: {
GlFormGroup,
......
......@@ -13,7 +13,7 @@ describe('ExpirationToggle', () => {
const findToggle = () => wrapper.find(GlToggle);
const findDescription = () => wrapper.find('[data-testid="description"]');
const mountComponent = propsData => {
const mountComponent = (propsData) => {
wrapper = shallowMount(component, {
stubs: {
GlFormGroup,
......
......@@ -59,7 +59,7 @@ describe('Registry Settings App', () => {
apolloProvider: fakeApollo,
});
return requestHandlers.map(request => request[1]);
return requestHandlers.map((request) => request[1]);
};
afterEach(() => {
......
......@@ -103,7 +103,7 @@ describe('Settings Form', () => {
},
});
return requestHandlers.map(resolvers => resolvers[1]);
return requestHandlers.map((resolvers) => resolvers[1]);
};
beforeEach(() => {
......
......@@ -8,7 +8,7 @@ export const containerExpirationPolicyData = () => ({
nextRunAt: '2020-11-19T07:37:03.941Z',
});
export const expirationPolicyPayload = override => ({
export const expirationPolicyPayload = (override) => ({
data: {
project: {
containerExpirationPolicy: {
......
......@@ -14,7 +14,7 @@ describe('RelatedMergeRequests', () => {
let mock;
let mockData;
beforeEach(done => {
beforeEach((done) => {
loadFixtures(FIXTURE_PATH);
mockData = getJSONFixture(FIXTURE_PATH);
......
......@@ -23,7 +23,7 @@ describe('RelatedMergeRequest store actions', () => {
});
describe('setInitialState', () => {
it('commits types.SET_INITIAL_STATE with given props', done => {
it('commits types.SET_INITIAL_STATE with given props', (done) => {
const props = { a: 1, b: 2 };
testAction(
......@@ -38,13 +38,13 @@ describe('RelatedMergeRequest store actions', () => {
});
describe('requestData', () => {
it('commits types.REQUEST_DATA', done => {
it('commits types.REQUEST_DATA', (done) => {
testAction(actions.requestData, null, {}, [{ type: types.REQUEST_DATA }], [], done);
});
});
describe('receiveDataSuccess', () => {
it('commits types.RECEIVE_DATA_SUCCESS with data', done => {
it('commits types.RECEIVE_DATA_SUCCESS with data', (done) => {
const data = { a: 1, b: 2 };
testAction(
......@@ -59,7 +59,7 @@ describe('RelatedMergeRequest store actions', () => {
});
describe('receiveDataError', () => {
it('commits types.RECEIVE_DATA_ERROR', done => {
it('commits types.RECEIVE_DATA_ERROR', (done) => {
testAction(
actions.receiveDataError,
null,
......@@ -73,7 +73,7 @@ describe('RelatedMergeRequest store actions', () => {
describe('fetchMergeRequests', () => {
describe('for a successful request', () => {
it('should dispatch success action', done => {
it('should dispatch success action', (done) => {
const data = { a: 1 };
mock.onGet(`${state.apiEndpoint}?per_page=100`).replyOnce(200, data, { 'x-total': 2 });
......@@ -89,7 +89,7 @@ describe('RelatedMergeRequest store actions', () => {
});
describe('for a failing request', () => {
it('should dispatch error action', done => {
it('should dispatch error action', (done) => {
mock.onGet(`${state.apiEndpoint}?per_page=100`).replyOnce(400);
testAction(
......
......@@ -71,7 +71,7 @@ describe('Release edit/new component', () => {
await wrapper.vm.$nextTick();
wrapper.element.querySelectorAll('input').forEach(input => jest.spyOn(input, 'focus'));
wrapper.element.querySelectorAll('input').forEach((input) => jest.spyOn(input, 'focus'));
};
beforeEach(() => {
......@@ -104,7 +104,7 @@ describe('Release edit/new component', () => {
const firstEnabledInput = wrapper.element.querySelector('input:enabled');
const allInputs = wrapper.element.querySelectorAll('input');
allInputs.forEach(input => {
allInputs.forEach((input) => {
const expectedFocusCalls = input === firstEnabledInput ? 1 : 0;
expect(input.focus).toHaveBeenCalledTimes(expectedFocusCalls);
});
......@@ -152,7 +152,7 @@ describe('Release edit/new component', () => {
beforeEach(async () => {
commonUtils.getParameterByName = jest
.fn()
.mockImplementation(paramToGet => ({ [BACK_URL_PARAM]: backUrl }[paramToGet]));
.mockImplementation((paramToGet) => ({ [BACK_URL_PARAM]: backUrl }[paramToGet]));
await factory();
});
......
......@@ -13,7 +13,7 @@ import ReleasesPagination from '~/releases/components/releases_pagination.vue';
jest.mock('~/lib/utils/common_utils', () => ({
...jest.requireActual('~/lib/utils/common_utils'),
getParameterByName: jest.fn().mockImplementation(paramName => {
getParameterByName: jest.fn().mockImplementation((paramName) => {
return `${paramName}_param_value`;
}),
}));
......@@ -28,7 +28,7 @@ describe('Releases App ', () => {
let wrapper;
let fetchReleaseSpy;
const paginatedReleases = rge(21).map(index => ({
const paginatedReleases = rge(21).map((index) => ({
...convertObjectPropsToCamelCase(release, { deep: true }),
tagName: `${index}.00`,
}));
......
......@@ -17,7 +17,7 @@ describe('Release show component', () => {
release = convertObjectPropsToCamelCase(originalRelease);
});
const factory = state => {
const factory = (state) => {
actions = {
fetchRelease: jest.fn(),
};
......
......@@ -30,7 +30,7 @@ describe('Release edit component', () => {
updateAssetLinkName: jest.fn(),
updateAssetLinkType: jest.fn(),
removeAssetLink: jest.fn().mockImplementation((_context, linkId) => {
state.release.assets.links = state.release.assets.links.filter(l => l.id !== linkId);
state.release.assets.links = state.release.assets.links.filter((l) => l.id !== linkId);
}),
};
......@@ -104,7 +104,7 @@ describe('Release edit component', () => {
expect(actions.updateAssetLinkUrl).not.toHaveBeenCalled();
};
const dispatchKeydowEvent = eventParams => {
const dispatchKeydowEvent = (eventParams) => {
const event = new KeyboardEvent('keydown', eventParams);
input.dispatchEvent(event);
......@@ -162,7 +162,7 @@ describe('Release edit component', () => {
expect(actions.updateAssetLinkUrl).not.toHaveBeenCalled();
};
const dispatchKeydowEvent = eventParams => {
const dispatchKeydowEvent = (eventParams) => {
const event = new KeyboardEvent('keydown', eventParams);
input.dispatchEvent(event);
......
......@@ -7,7 +7,7 @@ describe('~/releases/components/issuable_stats.vue', () => {
let wrapper;
let defaultProps;
const createComponent = propUpdates => {
const createComponent = (propUpdates) => {
wrapper = mount(IssuableStats, {
propsData: {
...defaultProps,
......
......@@ -26,8 +26,8 @@ describe('Release block assets', () => {
});
};
const findSectionHeading = type =>
wrapper.findAll('h5').filter(h5 => h5.text() === sections[type]);
const findSectionHeading = (type) =>
wrapper.findAll('h5').filter((h5) => h5.text() === sections[type]);
beforeEach(() => {
defaultProps = { assets: convertObjectPropsToCamelCase(assets, { deep: true }) };
......@@ -53,7 +53,7 @@ describe('Release block assets', () => {
});
it('renders sources with the expected text and URL', () => {
defaultProps.assets.sources.forEach(s => {
defaultProps.assets.sources.forEach((s) => {
const sourceLink = wrapper.find(`li>a[href="${s.url}"]`);
expect(sourceLink.exists()).toBe(true);
......@@ -62,7 +62,7 @@ describe('Release block assets', () => {
});
it('renders a heading for each assets type (except sources)', () => {
Object.keys(sections).forEach(type => {
Object.keys(sections).forEach((type) => {
const sectionHeadings = findSectionHeading(type);
expect(sectionHeadings).toHaveLength(1);
......@@ -70,7 +70,7 @@ describe('Release block assets', () => {
});
it('renders asset links with the expected text and URL', () => {
defaultProps.assets.links.forEach(l => {
defaultProps.assets.links.forEach((l) => {
const sourceLink = wrapper.find(`li>a[href="${l.directAssetUrl}"]`);
expect(sourceLink.exists()).toBe(true);
......@@ -84,7 +84,7 @@ describe('Release block assets', () => {
beforeEach(() => {
defaultProps.assets.links = defaultProps.assets.links.filter(
l => l.linkType !== typeToExclude,
(l) => l.linkType !== typeToExclude,
);
createComponent(defaultProps);
});
......@@ -98,7 +98,7 @@ describe('Release block assets', () => {
describe('sources', () => {
const testSources = ({ shouldSourcesBeRendered }) => {
assets.sources.forEach(s => {
assets.sources.forEach((s) => {
expect(wrapper.find(`a[href="${s.url}"]`).exists()).toBe(shouldSourcesBeRendered);
});
};
......
......@@ -12,7 +12,7 @@ describe('Release block milestone info', () => {
let wrapper;
let milestones;
const factory = props => {
const factory = (props) => {
wrapper = mount(ReleaseBlockMilestoneInfo, {
propsData: props,
});
......@@ -106,10 +106,10 @@ describe('Release block milestone info', () => {
});
}
fullListString = lotsOfMilestones.map(m => m.title).join('');
fullListString = lotsOfMilestones.map((m) => m.title).join('');
abbreviatedListString = lotsOfMilestones
.slice(0, MAX_MILESTONES_TO_DISPLAY)
.map(m => m.title)
.map((m) => m.title)
.join('');
return factory({ milestones: lotsOfMilestones });
......@@ -157,7 +157,7 @@ describe('Release block milestone info', () => {
/** Ensures we don't have any issues with dividing by zero when computing percentages */
describe('when all issue counts are zero', () => {
beforeEach(() => {
milestones = milestones.map(m => ({
milestones = milestones.map((m) => ({
...m,
issueStats: {
...m.issueStats,
......@@ -174,7 +174,7 @@ describe('Release block milestone info', () => {
describe('if the API response is missing the "issue_stats" property', () => {
beforeEach(() => {
milestones = milestones.map(m => ({
milestones = milestones.map((m) => ({
...m,
issueStats: undefined,
}));
......@@ -195,7 +195,7 @@ describe('Release block milestone info', () => {
describe('if the API response includes the "mr_stats" property', () => {
beforeEach(() => {
milestones = milestones.map(m => ({
milestones = milestones.map((m) => ({
...m,
mrStats: {
total: 15,
......
......@@ -24,7 +24,7 @@ describe('~/releases/components/releases_pagination_graphql.vue', () => {
const projectPath = 'my/project';
const createComponent = pageInfo => {
const createComponent = (pageInfo) => {
listModule = createListModule({ projectPath });
listModule.state.graphQlPageInfo = pageInfo;
......
......@@ -17,7 +17,7 @@ describe('~/releases/components/releases_pagination_rest.vue', () => {
const projectId = 19;
const createComponent = pageInfo => {
const createComponent = (pageInfo) => {
listModule = createListModule({ projectId });
listModule.state.restPageInfo = pageInfo;
......
......@@ -10,7 +10,7 @@ localVue.use(Vuex);
describe('~/releases/components/releases_pagination.vue', () => {
let wrapper;
const createComponent = useGraphQLEndpoint => {
const createComponent = (useGraphQLEndpoint) => {
const store = new Vuex.Store({
getters: {
useGraphQLEndpoint: () => useGraphQLEndpoint,
......
......@@ -83,7 +83,7 @@ describe('releases/components/tag_field_new', () => {
* @param {'shown' | 'hidden'} state The expected state of the validation message.
* Should be passed either 'shown' or 'hidden'
*/
const expectValidationMessageToBe = state => {
const expectValidationMessageToBe = (state) => {
return wrapper.vm.$nextTick().then(() => {
expect(findTagNameFormGroup().element).toHaveClass(
state === 'shown' ? 'is-invalid' : 'is-valid',
......
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