Commit 7c1fa749 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 37 files - 63 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 5c23cb94
......@@ -1887,45 +1887,6 @@ spec/frontend/helpers/vuex_action_helper_spec.js
spec/frontend/helpers/wait_for_promises.js
spec/frontend/helpers/wait_using_real_timer.js
## determined-shamir
spec/frontend/logs/components/environment_logs_spec.js
spec/frontend/logs/components/log_advanced_filters_spec.js
spec/frontend/logs/components/log_control_buttons_spec.js
spec/frontend/logs/components/log_simple_filters_spec.js
spec/frontend/logs/stores/actions_spec.js
spec/frontend/logs/stores/mutations_spec.js
spec/frontend/matchers.js
spec/frontend/matchers_spec.js
spec/frontend/members/components/avatars/user_avatar_spec.js
spec/frontend/members/components/filter_sort/filter_sort_container_spec.js
spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js
spec/frontend/members/components/filter_sort/sort_dropdown_spec.js
spec/frontend/members/components/modals/remove_group_link_modal_spec.js
spec/frontend/members/components/table/created_at_spec.js
spec/frontend/members/components/table/expiration_datepicker_spec.js
spec/frontend/members/components/table/expires_at_spec.js
spec/frontend/members/components/table/member_avatar_spec.js
spec/frontend/members/components/table/member_source_spec.js
spec/frontend/members/components/table/members_table_spec.js
spec/frontend/members/components/table/role_dropdown_spec.js
spec/frontend/members/utils_spec.js
spec/frontend/merge_request_spec.js
spec/frontend/merge_request_tabs_spec.js
spec/frontend/milestones/milestone_combobox_spec.js
spec/frontend/mini_pipeline_graph_dropdown_spec.js
spec/frontend/mocks/ce/lib/utils/axios_utils.js
spec/frontend/mocks/mocks_helper.js
spec/frontend/mocks/mocks_helper_spec.js
spec/frontend/monitoring/alert_widget_spec.js
spec/frontend/monitoring/components/charts/annotations_spec.js
spec/frontend/monitoring/components/charts/anomaly_spec.js
spec/frontend/monitoring/components/charts/bar_spec.js
spec/frontend/monitoring/components/charts/column_spec.js
spec/frontend/monitoring/components/charts/gauge_spec.js
spec/frontend/monitoring/components/charts/options_spec.js
spec/frontend/monitoring/components/charts/stacked_column_spec.js
spec/frontend/monitoring/components/charts/time_series_spec.js
## beautiful-benz
spec/frontend/monitoring/components/dashboard_actions_menu_spec.js
spec/frontend/monitoring/components/dashboard_header_spec.js
......
......@@ -20,7 +20,7 @@ jest.mock('~/lib/utils/scroll_utils');
const module = 'environmentLogs';
jest.mock('lodash/throttle', () =>
jest.fn(func => {
jest.fn((func) => {
return func;
}),
);
......@@ -59,7 +59,7 @@ describe('EnvironmentLogs', () => {
const findInfiniteScroll = () => wrapper.find({ ref: 'infiniteScroll' });
const findLogTrace = () => wrapper.find({ ref: 'logTrace' });
const findLogFooter = () => wrapper.find({ ref: 'logFooter' });
const getInfiniteScrollAttr = attr => parseInt(findInfiniteScroll().attributes(attr), 10);
const getInfiniteScrollAttr = (attr) => parseInt(findInfiniteScroll().attributes(attr), 10);
const mockSetInitData = () => {
state.pods.options = mockPods;
......@@ -213,7 +213,7 @@ describe('EnvironmentLogs', () => {
describe('state with data', () => {
beforeEach(() => {
dispatch.mockImplementation(actionName => {
dispatch.mockImplementation((actionName) => {
if (actionName === `${module}/setInitData`) {
mockSetInitData();
} else if (actionName === `${module}/showPodLogs`) {
......
......@@ -18,10 +18,10 @@ describe('LogAdvancedFilters', () => {
const findFilteredSearch = () => wrapper.find(GlFilteredSearch);
const findTimeRangePicker = () => wrapper.find({ ref: 'dateTimePicker' });
const getSearchToken = type =>
const getSearchToken = (type) =>
findFilteredSearch()
.props('availableTokens')
.filter(token => token.type === type)[0];
.filter((token) => token.type === type)[0];
const mockStateLoading = () => {
state.timeRange.selected = defaultTimeRange;
......
......@@ -9,7 +9,7 @@ describe('LogControlButtons', () => {
const findScrollToBottom = () => wrapper.find('.js-scroll-to-bottom');
const findRefreshBtn = () => wrapper.find('.js-refresh-log');
const initWrapper = opts => {
const initWrapper = (opts) => {
wrapper = shallowMount(LogControlButtons, {
listeners: {
scrollUp: () => {},
......
......@@ -18,7 +18,7 @@ describe('LogSimpleFilters', () => {
const findPodsDropdownItems = () =>
findPodsDropdown()
.findAll(GlDropdownItem)
.filter(item => !('disabled' in item.attributes()));
.filter((item) => !('disabled' in item.attributes()));
const mockPodsLoading = () => {
state.pods.options = [];
......
......@@ -62,7 +62,7 @@ describe('Logs Store actions', () => {
const latestGetParams = () => mock.history.get[mock.history.get.length - 1].params;
convertToFixedRange.mockImplementation(range => {
convertToFixedRange.mockImplementation((range) => {
if (range === defaultTimeRange) {
return { ...mockDefaultRange };
}
......
......@@ -23,7 +23,7 @@ describe('Logs Store Mutations', () => {
});
it('ensures mutation types are correctly named', () => {
Object.keys(types).forEach(k => {
Object.keys(types).forEach((k) => {
expect(k).toEqual(types[k]);
});
});
......
......@@ -10,7 +10,7 @@ export default {
const iconReferences = [].slice.apply(element.querySelectorAll('svg use'));
const matchingIcon = iconReferences.find(
reference => reference.parentNode.getAttribute('data-testid') === `${iconName}-icon`,
(reference) => reference.parentNode.getAttribute('data-testid') === `${iconName}-icon`,
);
const pass = Boolean(matchingIcon);
......@@ -21,7 +21,7 @@ export default {
} else {
message = `${element.outerHTML} does not contain the sprite icon "${iconName}"!`;
const existingIcons = iconReferences.map(reference => {
const existingIcons = iconReferences.map((reference) => {
const iconUrl = reference.getAttribute('href');
return `"${iconUrl.replace(/^.+#/, '')}"`;
});
......
......@@ -3,7 +3,7 @@ describe('Custom jest matchers', () => {
describe('malformed input', () => {
it.each([null, 1, Symbol, Array, Object])(
'fails graciously if the expected value is %s',
expected => {
(expected) => {
expect(expected).not.toMatchInterpolatedText('null');
},
);
......@@ -11,7 +11,7 @@ describe('Custom jest matchers', () => {
describe('malformed matcher', () => {
it.each([null, 1, Symbol, Array, Object])(
'fails graciously if the matcher is %s',
matcher => {
(matcher) => {
expect('null').not.toMatchInterpolatedText(matcher);
},
);
......
......@@ -22,7 +22,7 @@ describe('UserAvatar', () => {
const getByText = (text, options) =>
createWrapper(within(wrapper.element).findByText(text, options));
const findStatusEmoji = emoji => wrapper.find(`gl-emoji[data-name="${emoji}"]`);
const findStatusEmoji = (emoji) => wrapper.find(`gl-emoji[data-name="${emoji}"]`);
afterEach(() => {
wrapper.destroy();
......
......@@ -10,7 +10,7 @@ localVue.use(Vuex);
describe('FilterSortContainer', () => {
let wrapper;
const createComponent = state => {
const createComponent = (state) => {
const store = new Vuex.Store({
state: {
filteredSearchBar: {
......
......@@ -10,7 +10,7 @@ localVue.use(Vuex);
describe('MembersFilteredSearchBar', () => {
let wrapper;
const createComponent = state => {
const createComponent = (state) => {
const store = new Vuex.Store({
state: {
sourceId: 1,
......
......@@ -12,7 +12,7 @@ describe('SortDropdown', () => {
const URL_HOST = 'https://localhost/';
const createComponent = state => {
const createComponent = (state) => {
const store = new Vuex.Store({
state: {
sourceId: 1,
......@@ -38,10 +38,10 @@ describe('SortDropdown', () => {
const findSortDirectionToggle = () =>
findSortingComponent().find('button[title="Sort direction"]');
const findDropdownToggle = () => wrapper.find('button[aria-haspopup="true"]');
const findDropdownItemByText = text =>
const findDropdownItemByText = (text) =>
wrapper
.findAll(GlSortingItem)
.wrappers.find(dropdownItemWrapper => dropdownItemWrapper.text() === text);
.wrappers.find((dropdownItemWrapper) => dropdownItemWrapper.text() === text);
describe('dropdown options', () => {
beforeEach(() => {
......@@ -76,7 +76,7 @@ describe('SortDropdown', () => {
createComponent();
expectedDropdownItems.forEach(expectedDropdownItem => {
expectedDropdownItems.forEach((expectedDropdownItem) => {
const dropdownItem = findDropdownItemByText(expectedDropdownItem.label);
expect(dropdownItem).not.toBe(null);
......
......@@ -31,7 +31,7 @@ describe('RemoveGroupLinkModal', () => {
});
};
const createComponent = state => {
const createComponent = (state) => {
wrapper = mount(RemoveGroupLinkModal, {
localVue,
store: createStore(state),
......
......@@ -13,7 +13,7 @@ describe('CreatedAt', () => {
let wrapper;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = mount(CreatedAt, {
propsData: {
date,
......
......@@ -25,7 +25,7 @@ describe('ExpirationDatepicker', () => {
actions = {
updateMemberExpiration: jest.fn(
() =>
new Promise(resolve => {
new Promise((resolve) => {
resolveUpdateMemberExpiration = resolve;
}),
),
......
......@@ -10,7 +10,7 @@ describe('ExpiresAt', () => {
let wrapper;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = mount(ExpiresAt, {
propsData,
directives: {
......@@ -22,7 +22,7 @@ describe('ExpiresAt', () => {
const getByText = (text, options) =>
createWrapper(within(wrapper.element).getByText(text, options));
const getTooltipDirective = elementWrapper => getBinding(elementWrapper.element, 'gl-tooltip');
const getTooltipDirective = (elementWrapper) => getBinding(elementWrapper.element, 'gl-tooltip');
afterEach(() => {
wrapper.destroy();
......
......@@ -9,7 +9,7 @@ import InviteAvatar from '~/members/components/avatars/invite_avatar.vue';
describe('MemberList', () => {
let wrapper;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = shallowMount(MemberAvatar, {
propsData: {
isCurrentUser: false,
......
......@@ -6,7 +6,7 @@ import MemberSource from '~/members/components/table/member_source.vue';
describe('MemberSource', () => {
let wrapper;
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = mount(MemberSource, {
propsData: {
memberSource: {
......@@ -25,7 +25,7 @@ describe('MemberSource', () => {
const getByText = (text, options) =>
createWrapper(getByTextHelper(wrapper.element, text, options));
const getTooltipDirective = elementWrapper => getBinding(elementWrapper.element, 'gl-tooltip');
const getTooltipDirective = (elementWrapper) => getBinding(elementWrapper.element, 'gl-tooltip');
afterEach(() => {
wrapper.destroy();
......
......@@ -39,7 +39,7 @@ describe('MembersTable', () => {
});
};
const createComponent = state => {
const createComponent = (state) => {
wrapper = mount(MembersTable, {
localVue,
store: createStore(state),
......
......@@ -44,7 +44,7 @@ describe('RoleDropdown', () => {
const getDropdownMenu = () => within(wrapper.element).getByRole('menu');
const getByTextInDropdownMenu = (text, options = {}) =>
createWrapper(within(getDropdownMenu()).getByText(text, options));
const getDropdownItemByText = text =>
const getDropdownItemByText = (text) =>
createWrapper(
within(getDropdownMenu())
.getByText(text, { selector: '[role="menuitem"] p' })
......@@ -53,7 +53,7 @@ describe('RoleDropdown', () => {
const getCheckedDropdownItem = () =>
wrapper
.findAll(GlDropdownItem)
.wrappers.find(dropdownItemWrapper => dropdownItemWrapper.props('isChecked'));
.wrappers.find((dropdownItemWrapper) => dropdownItemWrapper.props('isChecked'));
const findDropdownToggle = () => wrapper.find('button[aria-haspopup="true"]');
const findDropdown = () => wrapper.find(GlDropdown);
......@@ -63,7 +63,7 @@ describe('RoleDropdown', () => {
});
describe('when dropdown is open', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent();
findDropdownToggle().trigger('click');
......@@ -73,7 +73,7 @@ describe('RoleDropdown', () => {
});
it('renders all valid roles', () => {
Object.keys(member.validRoles).forEach(role => {
Object.keys(member.validRoles).forEach((role) => {
expect(getDropdownItemByText(role).exists()).toBe(true);
});
});
......
......@@ -24,7 +24,7 @@ describe('Members Utils', () => {
it('has correct properties for each badge', () => {
const badges = generateBadges(memberMock, true);
badges.forEach(badge => {
badges.forEach((badge) => {
expect(badge).toEqual(
expect.objectContaining({
show: expect.any(Boolean),
......
......@@ -28,7 +28,7 @@ describe('MergeRequest', () => {
mock.restore();
});
it('modifies the Markdown field', done => {
it('modifies the Markdown field', (done) => {
jest.spyOn($, 'ajax').mockImplementation();
const changeEvent = document.createEvent('HTMLEvents');
changeEvent.initEvent('change', true, true);
......@@ -41,7 +41,7 @@ describe('MergeRequest', () => {
});
});
it('ensure that task with only spaces does not get checked incorrectly', done => {
it('ensure that task with only spaces does not get checked incorrectly', (done) => {
// fixed in 'deckar01-task_list', '2.2.1' gem
jest.spyOn($, 'ajax').mockImplementation();
const changeEvent = document.createEvent('HTMLEvents');
......@@ -61,7 +61,7 @@ describe('MergeRequest', () => {
const index = 3;
const checked = true;
it('submits an ajax request on tasklist:changed', done => {
it('submits an ajax request on tasklist:changed', (done) => {
$('.js-task-list-field').trigger({
type: 'tasklist:changed',
detail: { lineNumber, lineSource, index, checked },
......@@ -83,7 +83,7 @@ describe('MergeRequest', () => {
});
});
it('shows an error notification when tasklist update failed', done => {
it('shows an error notification when tasklist update failed', (done) => {
mock
.onPatch(`${TEST_HOST}/frontend-fixtures/merge-requests-project/-/merge_requests/1.json`)
.reply(409, {});
......
......@@ -14,7 +14,7 @@ jest.mock('~/lib/utils/webpack', () => ({
describe('MergeRequestTabs', () => {
const testContext = {};
const stubLocation = {};
const setLocation = stubs => {
const setLocation = (stubs) => {
const defaults = {
pathname: '',
search: '',
......@@ -265,7 +265,7 @@ describe('MergeRequestTabs', () => {
beforeEach(() => {
jest.spyOn(mainContent, 'getBoundingClientRect').mockReturnValue({ top: 10 });
jest.spyOn(tabContent, 'getBoundingClientRect').mockReturnValue({ top: 100 });
jest.spyOn(document, 'querySelector').mockImplementation(selector => {
jest.spyOn(document, 'querySelector').mockImplementation((selector) => {
return selector === '.content-wrapper' ? mainContent : tabContent;
});
testContext.class.currentAction = 'commits';
......
......@@ -41,7 +41,7 @@ describe('Milestone combobox component', () => {
attrs,
listeners: {
// simulate a parent component v-model binding
input: selectedMilestone => {
input: (selectedMilestone) => {
wrapper.setProps({ value: selectedMilestone });
},
},
......@@ -71,13 +71,13 @@ describe('Milestone combobox component', () => {
mock
.onGet(`/api/v4/projects/${projectId}/milestones`)
.reply(config => projectMilestonesApiCallSpy(config));
.reply((config) => projectMilestonesApiCallSpy(config));
mock
.onGet(`/api/v4/groups/${groupId}/milestones`)
.reply(config => groupMilestonesApiCallSpy(config));
.reply((config) => groupMilestonesApiCallSpy(config));
mock.onGet(`/api/v4/projects/${projectId}/search`).reply(config => searchApiCallSpy(config));
mock.onGet(`/api/v4/projects/${projectId}/search`).reply((config) => searchApiCallSpy(config));
});
afterEach(() => {
......@@ -129,7 +129,7 @@ describe('Milestone combobox component', () => {
//
// Convenience methods
//
const updateQuery = newQuery => {
const updateQuery = (newQuery) => {
findSearchBox().vm.$emit('input', newQuery);
};
......
......@@ -64,7 +64,7 @@ describe('Mini Pipeline Graph Dropdown', () => {
expect(ajaxSpy.mock.calls[0][0]).toEqual('foobar');
});
it('should not close when user uses cmd/ctrl + click', done => {
it('should not close when user uses cmd/ctrl + click', (done) => {
mock.onGet('foobar').reply(200, {
html: `<li>
<a class="mini-pipeline-graph-dropdown-item" href="#">
......@@ -90,7 +90,7 @@ describe('Mini Pipeline Graph Dropdown', () => {
.catch(done.fail);
});
it('should close the dropdown when request returns an error', done => {
it('should close the dropdown when request returns an error', (done) => {
mock.onGet('foobar').networkError();
new MiniPipelineGraph({ container: '.js-builds-dropdown-tests' }).bindEvents();
......
......@@ -5,7 +5,7 @@ const axios = jest.requireActual('~/lib/utils/axios_utils').default;
axios.isMock = true;
// Fail tests for unmocked requests
axios.defaults.adapter = config => {
axios.defaults.adapter = (config) => {
const message =
`Unexpected unmocked request: ${JSON.stringify(config, null, 2)}\n` +
'Consider using the `axios-mock-adapter` module in tests.';
......@@ -23,7 +23,7 @@ const onRequest = () => {
};
// Use setImmediate to alloow the response interceptor to finish
const onResponse = config => {
const onResponse = (config) => {
activeRequests -= 1;
setImmediate(() => {
events.emit('response', config);
......@@ -31,7 +31,7 @@ const onResponse = config => {
};
const subscribeToResponse = (predicate = () => true) =>
new Promise(resolve => {
new Promise((resolve) => {
const listener = (config = {}) => {
if (predicate(config)) {
events.off('response', listener);
......@@ -49,7 +49,7 @@ const subscribeToResponse = (predicate = () => true) =>
/**
* Registers a callback function to be run after a request to the given URL finishes.
*/
axios.waitFor = url => subscribeToResponse(({ url: configUrl }) => configUrl === url);
axios.waitFor = (url) => subscribeToResponse(({ url: configUrl }) => configUrl === url);
/**
* Registers a callback function to be run after all requests have finished. If there are no requests waiting, the callback is executed immediately.
......@@ -58,18 +58,18 @@ axios.waitForAll = () => subscribeToResponse(() => activeRequests === 0);
axios.countActiveRequests = () => activeRequests;
axios.interceptors.request.use(config => {
axios.interceptors.request.use((config) => {
onRequest();
return config;
});
// Remove the global counter
axios.interceptors.response.use(
response => {
(response) => {
onResponse(response.config);
return response;
},
err => {
(err) => {
onResponse(err.config);
return Promise.reject(err);
},
......
......@@ -19,9 +19,9 @@ const prefixMap = [
// { mocksRoot: 'virtual', requirePrefix: '' }, // We'll deal with virtual mocks later
];
const mockFileFilter = stats => stats.isFile() && stats.path.endsWith('.js');
const mockFileFilter = (stats) => stats.isFile() && stats.path.endsWith('.js');
const getMockFiles = root => readdir.sync(root, { deep: MAX_DEPTH, filter: mockFileFilter });
const getMockFiles = (root) => readdir.sync(root, { deep: MAX_DEPTH, filter: mockFileFilter });
// Function that performs setting a mock. This has to be overridden by the unit test, because
// jest.setMock can't be overwritten across files.
......@@ -36,7 +36,7 @@ export const setupManualMocks = function setupManualMocks(setMock = defaultSetMo
return;
}
getMockFiles(path.join(__dirname, mocksRoot)).forEach(mockPath => {
getMockFiles(path.join(__dirname, mocksRoot)).forEach((mockPath) => {
const mockPathNoExt = mockPath.substring(0, mockPath.length - path.extname(mockPath).length);
const sourcePath = path.join(requirePrefix, mockPathNoExt);
const mockPathRelative = `./${path.join(mocksRoot, mockPathNoExt)}`;
......
......@@ -47,13 +47,13 @@ describe('mocks_helper.js', () => {
const readdirSpy = readdir.sync;
expect(readdirSpy).toHaveBeenCalled();
readdirSpy.mock.calls.forEach(call => {
readdirSpy.mock.calls.forEach((call) => {
expect(call[1].deep).toBeLessThan(100);
});
});
it('sets up mocks for CE (the ~/ prefix)', () => {
fs.existsSync.mockImplementation(root => root.endsWith('ce'));
fs.existsSync.mockImplementation((root) => root.endsWith('ce'));
readdir.sync.mockReturnValue(['root.js', 'lib/utils/util.js']);
setupManualMocks();
......@@ -72,7 +72,7 @@ describe('mocks_helper.js', () => {
};
fs.existsSync.mockReturnValue(true);
readdir.sync.mockImplementation(root => files[root]);
readdir.sync.mockImplementation((root) => files[root]);
setupManualMocks();
expect(readdir.sync).toHaveBeenCalledTimes(1);
......@@ -84,7 +84,7 @@ describe('mocks_helper.js', () => {
});
it('fails when given a virtual mock', () => {
fs.existsSync.mockImplementation(p => p.endsWith('ce'));
fs.existsSync.mockImplementation((p) => p.endsWith('ce'));
readdir.sync.mockReturnValue(['virtual', 'shouldntBeImported']);
setMock.mockImplementation(() => {
throw new Error('Could not locate module');
......@@ -106,7 +106,7 @@ describe('mocks_helper.js', () => {
});
});
it('survives jest.isolateModules()', done => {
it('survives jest.isolateModules()', (done) => {
jest.isolateModules(() => {
const axios2 = require('~/lib/utils/axios_utils').default;
expect(axios2.isMock).toBe(true);
......
......@@ -83,7 +83,7 @@ describe('AlertWidget', () => {
},
};
const createComponent = propsData => {
const createComponent = (propsData) => {
wrapper = shallowMount(AlertWidget, {
stubs: { GlTooltip, GlSprintf },
propsData: {
......@@ -108,7 +108,7 @@ describe('AlertWidget', () => {
it('displays a loading spinner and disables form when fetching alerts', () => {
let resolveReadAlert;
mockReadAlert.mockReturnValue(
new Promise(resolve => {
new Promise((resolve) => {
resolveReadAlert = resolve;
}),
);
......@@ -131,7 +131,7 @@ describe('AlertWidget', () => {
it('does not render loading spinner if showLoadingState is false', () => {
let resolveReadAlert;
mockReadAlert.mockReturnValue(
new Promise(resolve => {
new Promise((resolve) => {
resolveReadAlert = resolve;
}),
);
......
......@@ -36,7 +36,7 @@ describe('annotations spec', () => {
}),
);
annotations.data.forEach(annotation => {
annotations.data.forEach((annotation) => {
expect(annotation).toEqual(expect.any(Object));
});
......@@ -58,7 +58,7 @@ describe('annotations spec', () => {
}),
);
annotations.markLine.data.forEach(annotation => {
annotations.markLine.data.forEach((annotation) => {
expect(annotation).toEqual(expect.any(Object));
});
......@@ -83,7 +83,7 @@ describe('annotations spec', () => {
}),
);
annotations.markLine.data.forEach(annotation => {
annotations.markLine.data.forEach((annotation) => {
expect(annotation).toEqual(expect.any(Object));
});
......
......@@ -15,7 +15,7 @@ const TEST_LOWER = 9;
describe('Anomaly chart component', () => {
let wrapper;
const setupAnomalyChart = props => {
const setupAnomalyChart = (props) => {
wrapper = shallowMount(Anomaly, {
propsData: { ...props },
});
......@@ -91,7 +91,7 @@ describe('Anomaly chart component', () => {
expect(series.length).toEqual(2); // 1 upper + 1 lower boundaries
expect(series[0].stack).toEqual(series[1].stack);
series.forEach(s => {
series.forEach((s) => {
expect(s.type).toBe('line');
expect(s.lineStyle.width).toBe(0);
expect(s.lineStyle.color).toMatch(/rgba\(.+\)/);
......
......@@ -44,7 +44,7 @@ describe('Bar component', () => {
it('should return chartData as array of arrays', () => {
expect(chartData).toBeInstanceOf(Array);
chartData.forEach(item => {
chartData.forEach((item) => {
expect(item).toBeInstanceOf(Array);
});
});
......
......@@ -45,7 +45,7 @@ describe('Column component', () => {
});
};
const findChart = () => wrapper.find(GlColumnChart);
const chartProps = prop => findChart().props(prop);
const chartProps = (prop) => findChart().props(prop);
beforeEach(() => {
createWrapper();
......@@ -58,7 +58,7 @@ describe('Column component', () => {
describe('xAxisLabel', () => {
const mockDate = Date.UTC(2020, 4, 26, 20); // 8:00 PM in GMT
const useXAxisFormatter = date => {
const useXAxisFormatter = (date) => {
const { xAxis } = chartProps('option');
const { formatter } = xAxis.axisLabel;
return formatter(date);
......
......@@ -49,7 +49,7 @@ describe('Gauge Chart component', () => {
it.each(invalidCases)(
'if min has invalid value, defaults are used for both min and max',
invalidValue => {
(invalidValue) => {
createWrapper({ minValue: invalidValue });
expect(findGaugeChart().props('min')).toBe(MIN_DEFAULT);
......@@ -59,7 +59,7 @@ describe('Gauge Chart component', () => {
it.each(invalidCases)(
'if max has invalid value, defaults are used for both min and max',
invalidValue => {
(invalidValue) => {
createWrapper({ minValue: invalidValue });
expect(findGaugeChart().props('min')).toBe(MIN_DEFAULT);
......
......@@ -145,7 +145,7 @@ describe('options spec', () => {
expect(thresholds).toEqual([]);
});
it.each(invalidCases)('invalid values for thresholds are filtered out', invalidValue => {
it.each(invalidCases)('invalid values for thresholds are filtered out', (invalidValue) => {
thresholds = getValidThresholds({
mode: 'absolute',
range: { min: 0, max: 100 },
......@@ -197,7 +197,7 @@ describe('options spec', () => {
it.each(invalidCases)(
'when min has invalid value, empty result is returned',
invalidValue => {
(invalidValue) => {
thresholds = getValidThresholds({
mode: 'absolute',
range: { min: invalidValue, max: 100 },
......@@ -210,7 +210,7 @@ describe('options spec', () => {
it.each(invalidCases)(
'when max has invalid value, empty result is returned',
invalidValue => {
(invalidValue) => {
thresholds = getValidThresholds({
mode: 'absolute',
range: { min: 0, max: invalidValue },
......@@ -244,7 +244,7 @@ describe('options spec', () => {
it.each(invalidCases)(
'if invalid values are passed, empty result is returned',
invalidValue => {
(invalidValue) => {
thresholds = getValidThresholds({
mode: 'absolute',
range: { min: 0, max: 100 },
......@@ -259,7 +259,7 @@ describe('options spec', () => {
describe('mode', () => {
it.each(invalidCases)(
'if invalid values are passed, empty result is returned',
invalidValue => {
(invalidValue) => {
thresholds = getValidThresholds({
mode: invalidValue,
range: { min: 0, max: 100 },
......@@ -305,7 +305,7 @@ describe('options spec', () => {
const outOfPercentBoundsValues = [-1, 0, 100, 101];
it.each(outOfPercentBoundsValues)(
'when values out of 0-100 range are passed, empty result is returned',
invalidValue => {
(invalidValue) => {
thresholds = getValidThresholds({
mode: 'percentage',
range: { min: 0, max: 1000 },
......
......@@ -6,7 +6,7 @@ import StackedColumnChart from '~/monitoring/components/charts/stacked_column.vu
import { stackedColumnGraphData } from '../../graph_data';
jest.mock('~/lib/utils/icon_utils', () => ({
getSvgIconPathContent: jest.fn().mockImplementation(icon => Promise.resolve(`${icon}-content`)),
getSvgIconPathContent: jest.fn().mockImplementation((icon) => Promise.resolve(`${icon}-content`)),
}));
describe('Stacked column chart component', () => {
......@@ -48,7 +48,7 @@ describe('Stacked column chart component', () => {
data.forEach((series, index) => {
const { values } = stackedColumnMockedData.metrics[index].result[0];
expect(series.data).toEqual(values.map(value => value[1]));
expect(series.data).toEqual(values.map((value) => value[1]));
});
});
......
......@@ -23,14 +23,14 @@ import { timeSeriesGraphData } from '../../graph_data';
jest.mock('lodash/throttle', () =>
// this throttle mock executes immediately
jest.fn(func => {
jest.fn((func) => {
// eslint-disable-next-line no-param-reassign
func.cancel = jest.fn();
return func;
}),
);
jest.mock('~/lib/utils/icon_utils', () => ({
getSvgIconPathContent: jest.fn().mockImplementation(icon => Promise.resolve(`${icon}-content`)),
getSvgIconPathContent: jest.fn().mockImplementation((icon) => Promise.resolve(`${icon}-content`)),
}));
describe('Time series component', () => {
......@@ -122,7 +122,7 @@ describe('Time series component', () => {
},
],
}),
off: jest.fn(eChartEvent => {
off: jest.fn((eChartEvent) => {
delete eChartMock.handlers[eChartEvent];
}),
on: jest.fn((eChartEvent, fn) => {
......@@ -193,7 +193,7 @@ describe('Time series component', () => {
it('does not throw error if data point is outside the zoom range', () => {
const seriesDataWithoutValue = {
...mockLineSeriesData(),
seriesData: mockLineSeriesData().seriesData.map(data => ({
seriesData: mockLineSeriesData().seriesData.map((data) => ({
...data,
value: undefined,
})),
......@@ -270,7 +270,7 @@ describe('Time series component', () => {
beforeEach(() => {
wrapper.vm.formatTooltipText({
...mockAnnotationsSeriesData,
seriesData: mockAnnotationsSeriesData.seriesData.map(data => ({
seriesData: mockAnnotationsSeriesData.seriesData.map((data) => ({
...data,
data: annotationsMetadata,
})),
......@@ -546,7 +546,7 @@ describe('Time series component', () => {
describe('xAxisLabel', () => {
const mockDate = Date.UTC(2020, 4, 26, 20); // 8:00 PM in GMT
const useXAxisFormatter = date => {
const useXAxisFormatter = (date) => {
const { xAxis } = getChartOptions();
const { formatter } = xAxis.axisLabel;
return formatter(date);
......@@ -620,7 +620,7 @@ describe('Time series component', () => {
},
];
glChartComponents.forEach(dynamicComponent => {
glChartComponents.forEach((dynamicComponent) => {
describe(`GitLab UI: ${dynamicComponent.chartType}`, () => {
const findChartComponent = () => wrapper.find(dynamicComponent.component);
......@@ -705,7 +705,7 @@ describe('Time series component', () => {
let lineColors;
beforeEach(() => {
lineColors = wrapper.find(GlAreaChart).vm.series.map(item => item.lineStyle.color);
lineColors = wrapper.find(GlAreaChart).vm.series.map((item) => item.lineStyle.color);
});
it('should contain different colors for contiguous time series', () => {
......@@ -727,7 +727,7 @@ describe('Time series component', () => {
const legendColors = wrapper
.find(GlChartLegend)
.props('seriesInfo')
.map(item => item.color);
.map((item) => item.color);
lineColors.forEach((color, index) => {
expect(color).toBe(legendColors[index]);
......
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