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