Commit f2d28d7a authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 68 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 94cfbb0c
......@@ -435,7 +435,7 @@ describe('Release detail actions', () => {
expect(api.deleteReleaseLink).toHaveBeenCalledTimes(
getters.releaseLinksToDelete.length,
);
getters.releaseLinksToDelete.forEach(link => {
getters.releaseLinksToDelete.forEach((link) => {
expect(api.deleteReleaseLink).toHaveBeenCalledWith(
state.projectId,
state.tagName,
......@@ -446,7 +446,7 @@ describe('Release detail actions', () => {
expect(api.createReleaseLink).toHaveBeenCalledTimes(
getters.releaseLinksToCreate.length,
);
getters.releaseLinksToCreate.forEach(link => {
getters.releaseLinksToCreate.forEach((link) => {
expect(api.createReleaseLink).toHaveBeenCalledWith(
state.projectId,
state.tagName,
......
import state from '~/releases/stores/modules/list/state';
export const resetStore = store => {
export const resetStore = (store) => {
store.replaceState(state());
};
......@@ -17,7 +17,7 @@ describe('Accessibility Reports actions', () => {
});
describe('setEndpoints', () => {
it('should commit SET_ENDPOINTS mutation', done => {
it('should commit SET_ENDPOINTS mutation', (done) => {
const endpoint = 'endpoint.json';
testAction(
......@@ -46,7 +46,7 @@ describe('Accessibility Reports actions', () => {
});
describe('success', () => {
it('should commit REQUEST_REPORT mutation and dispatch receiveReportSuccess', done => {
it('should commit REQUEST_REPORT mutation and dispatch receiveReportSuccess', (done) => {
const data = { report: { summary: {} } };
mock.onGet(`${TEST_HOST}/endpoint.json`).reply(200, data);
......@@ -67,7 +67,7 @@ describe('Accessibility Reports actions', () => {
});
describe('error', () => {
it('should commit REQUEST_REPORT and RECEIVE_REPORT_ERROR mutations', done => {
it('should commit REQUEST_REPORT and RECEIVE_REPORT_ERROR mutations', (done) => {
mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500);
testAction(
......@@ -83,7 +83,7 @@ describe('Accessibility Reports actions', () => {
});
describe('receiveReportSuccess', () => {
it('should commit RECEIVE_REPORT_SUCCESS mutation with 200', done => {
it('should commit RECEIVE_REPORT_SUCCESS mutation with 200', (done) => {
testAction(
actions.receiveReportSuccess,
{ status: 200, data: mockReport },
......@@ -94,7 +94,7 @@ describe('Accessibility Reports actions', () => {
);
});
it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', done => {
it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', (done) => {
testAction(
actions.receiveReportSuccess,
{ status: 204, data: mockReport },
......@@ -107,7 +107,7 @@ describe('Accessibility Reports actions', () => {
});
describe('receiveReportError', () => {
it('should commit RECEIVE_REPORT_ERROR mutation', done => {
it('should commit RECEIVE_REPORT_ERROR mutation', (done) => {
testAction(
actions.receiveReportError,
null,
......
......@@ -33,7 +33,7 @@ describe('Codequality Reports actions', () => {
});
describe('setPaths', () => {
it('should commit SET_PATHS mutation', done => {
it('should commit SET_PATHS mutation', (done) => {
const paths = {
basePath: 'basePath',
headPath: 'headPath',
......@@ -67,7 +67,7 @@ describe('Codequality Reports actions', () => {
});
describe('on success', () => {
it('commits REQUEST_REPORTS and dispatches receiveReportsSuccess', done => {
it('commits REQUEST_REPORTS and dispatches receiveReportsSuccess', (done) => {
mock.onGet(`${TEST_HOST}/head.json`).reply(200, headIssues);
mock.onGet(`${TEST_HOST}/base.json`).reply(200, baseIssues);
......@@ -91,7 +91,7 @@ describe('Codequality Reports actions', () => {
});
describe('on error', () => {
it('commits REQUEST_REPORTS and dispatches receiveReportsError', done => {
it('commits REQUEST_REPORTS and dispatches receiveReportsError', (done) => {
mock.onGet(`${TEST_HOST}/head.json`).reply(500);
testAction(
......@@ -106,7 +106,7 @@ describe('Codequality Reports actions', () => {
});
describe('with no base path', () => {
it('commits REQUEST_REPORTS and dispatches receiveReportsError', done => {
it('commits REQUEST_REPORTS and dispatches receiveReportsError', (done) => {
localState.basePath = null;
testAction(
......@@ -122,7 +122,7 @@ describe('Codequality Reports actions', () => {
});
describe('receiveReportsSuccess', () => {
it('commits RECEIVE_REPORTS_SUCCESS', done => {
it('commits RECEIVE_REPORTS_SUCCESS', (done) => {
const data = { issues: [] };
testAction(
......@@ -137,7 +137,7 @@ describe('Codequality Reports actions', () => {
});
describe('receiveReportsError', () => {
it('commits RECEIVE_REPORTS_ERROR', done => {
it('commits RECEIVE_REPORTS_ERROR', (done) => {
testAction(
actions.receiveReportsError,
null,
......
......@@ -11,17 +11,17 @@ jest.mock('~/reports/codequality_report/workers/codequality_comparison_worker',
addEventListener: (_, callback) => {
mockPostMessageCallback = callback;
},
postMessage: data => {
postMessage: (data) => {
if (!data.headIssues) return mockPostMessageCallback({ data: {} });
if (!data.baseIssues) throw new Error();
const key = 'fingerprint';
return mockPostMessageCallback({
data: {
newIssues: data.headIssues.filter(
item => !data.baseIssues.find(el => el[key] === item[key]),
(item) => !data.baseIssues.find((el) => el[key] === item[key]),
),
resolvedIssues: data.baseIssues.filter(
item => !data.headIssues.find(el => el[key] === item[key]),
(item) => !data.headIssues.find((el) => el[key] === item[key]),
),
},
});
......
......@@ -13,7 +13,7 @@ describe('Grouped Issues List', () => {
});
};
const findHeading = groupName => wrapper.find(`[data-testid="${groupName}Heading"`);
const findHeading = (groupName) => wrapper.find(`[data-testid="${groupName}Heading"`);
afterEach(() => {
wrapper.destroy();
......@@ -37,7 +37,7 @@ describe('Grouped Issues List', () => {
describe('without data', () => {
beforeEach(createComponent);
it.each(['unresolved', 'resolved'])('does not a render a header for %s issues', issueName => {
it.each(['unresolved', 'resolved'])('does not a render a header for %s issues', (issueName) => {
expect(findHeading(issueName).exists()).toBe(false);
});
......@@ -59,7 +59,7 @@ describe('Grouped Issues List', () => {
expect(findHeading(groupName).text()).toBe(givenHeading);
});
it.each(['resolved', 'unresolved'])('renders all %s issues', issueName => {
it.each(['resolved', 'unresolved'])('renders all %s issues', (issueName) => {
const issues = [{ name: 'foo' }, { name: 'bar' }];
createComponent({
......
......@@ -39,7 +39,7 @@ describe('Grouped test reports app', () => {
});
};
const setReports = reports => {
const setReports = (reports) => {
mockStore.state.status = reports.status;
mockStore.state.summary = reports.summary;
mockStore.state.reports = reports.suites;
......
......@@ -20,7 +20,7 @@ describe('IssueStatusIcon', () => {
it.each([STATUS_SUCCESS, STATUS_NEUTRAL, STATUS_FAILED])(
'renders "%s" state correctly',
status => {
(status) => {
createComponent({ status });
expect(wrapper.element).toMatchSnapshot();
......
......@@ -29,7 +29,7 @@ describe('Report section', () => {
alwaysOpen: false,
};
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(reportSection, {
propsData: {
...defaultProps,
......@@ -67,7 +67,7 @@ describe('Report section', () => {
const issues = hasIssues ? 'has issues' : 'has no issues';
const open = alwaysOpen ? 'is always open' : 'is not always open';
it(`is ${isCollapsible}, if the report ${issues} and ${open}`, done => {
it(`is ${isCollapsible}, if the report ${issues} and ${open}`, (done) => {
vm.hasIssues = hasIssues;
vm.alwaysOpen = alwaysOpen;
......@@ -93,7 +93,7 @@ describe('Report section', () => {
const issues = isCollapsed ? 'is collapsed' : 'is not collapsed';
const open = alwaysOpen ? 'is always open' : 'is not always open';
it(`is ${isExpanded}, if the report ${issues} and ${open}`, done => {
it(`is ${isExpanded}, if the report ${issues} and ${open}`, (done) => {
vm.isCollapsed = isCollapsed;
vm.alwaysOpen = alwaysOpen;
......@@ -144,7 +144,7 @@ describe('Report section', () => {
describe('toggleCollapsed', () => {
const hiddenCss = { display: 'none' };
it('toggles issues', done => {
it('toggles issues', (done) => {
vm.$el.querySelector('button').click();
Vue.nextTick()
......@@ -163,7 +163,7 @@ describe('Report section', () => {
.catch(done.fail);
});
it('is always expanded, if always-open is set to true', done => {
it('is always expanded, if always-open is set to true', (done) => {
vm.alwaysOpen = true;
Vue.nextTick()
.then(() => {
......@@ -177,7 +177,7 @@ describe('Report section', () => {
});
describe('snowplow events', () => {
it('does emit an event on issue toggle if the shouldEmitToggleEvent prop does exist', done => {
it('does emit an event on issue toggle if the shouldEmitToggleEvent prop does exist', (done) => {
createComponent({ hasIssues: true, shouldEmitToggleEvent: true });
expect(wrapper.emitted().toggleEvent).toBeUndefined();
......@@ -192,7 +192,7 @@ describe('Report section', () => {
.catch(done.fail);
});
it('does not emit an event on issue toggle if the shouldEmitToggleEvent prop does not exist', done => {
it('does not emit an event on issue toggle if the shouldEmitToggleEvent prop does not exist', (done) => {
createComponent({ hasIssues: true });
expect(wrapper.emitted().toggleEvent).toBeUndefined();
......@@ -207,7 +207,7 @@ describe('Report section', () => {
.catch(done.fail);
});
it('does not emit an event if always-open is set to true', done => {
it('does not emit an event if always-open is set to true', (done) => {
createComponent({ alwaysOpen: true, hasIssues: true, shouldEmitToggleEvent: true });
wrapper.vm
......@@ -259,7 +259,7 @@ describe('Report section', () => {
});
describe('Success and Error slots', () => {
const createComponentWithSlots = status => {
const createComponentWithSlots = (status) => {
vm = mountComponentWithSlots(ReportSection, {
props: {
status,
......
......@@ -24,7 +24,7 @@ describe('Reports Store Actions', () => {
});
describe('setEndpoint', () => {
it('should commit SET_ENDPOINT mutation', done => {
it('should commit SET_ENDPOINT mutation', (done) => {
testAction(
setEndpoint,
'endpoint.json',
......@@ -37,7 +37,7 @@ describe('Reports Store Actions', () => {
});
describe('requestReports', () => {
it('should commit REQUEST_REPORTS mutation', done => {
it('should commit REQUEST_REPORTS mutation', (done) => {
testAction(requestReports, null, mockedState, [{ type: types.REQUEST_REPORTS }], [], done);
});
});
......@@ -57,7 +57,7 @@ describe('Reports Store Actions', () => {
});
describe('success', () => {
it('dispatches requestReports and receiveReportsSuccess ', done => {
it('dispatches requestReports and receiveReportsSuccess ', (done) => {
mock
.onGet(`${TEST_HOST}/endpoint.json`)
.replyOnce(200, { summary: {}, suites: [{ name: 'rspec' }] });
......@@ -86,7 +86,7 @@ describe('Reports Store Actions', () => {
mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500);
});
it('dispatches requestReports and receiveReportsError ', done => {
it('dispatches requestReports and receiveReportsError ', (done) => {
testAction(
fetchReports,
null,
......@@ -107,7 +107,7 @@ describe('Reports Store Actions', () => {
});
describe('receiveReportsSuccess', () => {
it('should commit RECEIVE_REPORTS_SUCCESS mutation with 200', done => {
it('should commit RECEIVE_REPORTS_SUCCESS mutation with 200', (done) => {
testAction(
receiveReportsSuccess,
{ data: { summary: {} }, status: 200 },
......@@ -118,7 +118,7 @@ describe('Reports Store Actions', () => {
);
});
it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', done => {
it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', (done) => {
testAction(
receiveReportsSuccess,
{ data: { summary: {} }, status: 204 },
......@@ -131,7 +131,7 @@ describe('Reports Store Actions', () => {
});
describe('receiveReportsError', () => {
it('should commit RECEIVE_REPORTS_ERROR mutation', done => {
it('should commit RECEIVE_REPORTS_ERROR mutation', (done) => {
testAction(
receiveReportsError,
null,
......@@ -144,7 +144,7 @@ describe('Reports Store Actions', () => {
});
describe('openModal', () => {
it('should dispatch setModalData', done => {
it('should dispatch setModalData', (done) => {
testAction(
openModal,
{ name: 'foo' },
......@@ -157,7 +157,7 @@ describe('Reports Store Actions', () => {
});
describe('setModalData', () => {
it('should commit SET_ISSUE_MODAL_DATA', done => {
it('should commit SET_ISSUE_MODAL_DATA', (done) => {
testAction(
setModalData,
{ name: 'foo' },
......
......@@ -12,7 +12,7 @@ let $collapseIcon = null;
let $page = null;
let $labelsIcon = null;
const assertSidebarState = state => {
const assertSidebarState = (state) => {
const shouldBeExpanded = state === 'expanded';
const shouldBeCollapsed = state === 'collapsed';
expect($aside.hasClass('right-sidebar-expanded')).toBe(shouldBeExpanded);
......@@ -67,7 +67,7 @@ describe('RightSidebar', () => {
assertSidebarState('collapsed');
});
it('should broadcast todo:toggle event when add todo clicked', done => {
it('should broadcast todo:toggle event when add todo clicked', (done) => {
const todos = getJSONFixture('todos/todos.json');
mock.onPost(/(.*)\/todos$/).reply(200, todos);
......@@ -84,7 +84,7 @@ describe('RightSidebar', () => {
});
it('should not hide collapsed icons', () => {
[].forEach.call(document.querySelectorAll('.sidebar-collapsed-icon'), el => {
[].forEach.call(document.querySelectorAll('.sidebar-collapsed-icon'), (el) => {
expect(el.querySelector('.fa, svg').classList.contains('hidden')).toBeFalsy();
});
});
......
......@@ -8,7 +8,7 @@ jest.mock('~/search/sidebar');
describe('initSearchApp', () => {
let defaultLocation;
const setUrl = query => {
const setUrl = (query) => {
window.location.href = `https://localhost:3000/search${query}`;
window.location.search = query;
};
......
......@@ -17,7 +17,7 @@ describe('GlobalSearchSidebar', () => {
resetQuery: jest.fn(),
};
const createComponent = initialState => {
const createComponent = (initialState) => {
const store = new Vuex.Store({
state: {
query: MOCK_QUERY,
......
......@@ -15,7 +15,7 @@ describe('ConfidentialityFilter', () => {
resetQuery: jest.fn(),
};
const createComponent = initialState => {
const createComponent = (initialState) => {
const store = new Vuex.Store({
state: {
query: MOCK_QUERY,
......
......@@ -46,7 +46,7 @@ describe('RadioFilter', () => {
const findGlRadioButtonGroup = () => wrapper.find(GlFormRadioGroup);
const findGlRadioButtons = () => findGlRadioButtonGroup().findAll(GlFormRadio);
const findGlRadioButtonsText = () => findGlRadioButtons().wrappers.map(w => w.text());
const findGlRadioButtonsText = () => findGlRadioButtons().wrappers.map((w) => w.text());
describe('template', () => {
beforeEach(() => {
......@@ -61,7 +61,7 @@ describe('RadioFilter', () => {
describe('Status Filter', () => {
it('renders a radio button for each filterOption', () => {
expect(findGlRadioButtonsText()).toStrictEqual(
stateFilterData.filterByScope[stateFilterData.scopes.ISSUES].map(f => {
stateFilterData.filterByScope[stateFilterData.scopes.ISSUES].map((f) => {
return f.value === stateFilterData.filters.ANY.value
? `Any ${stateFilterData.header.toLowerCase()}`
: f.label;
......@@ -87,7 +87,7 @@ describe('RadioFilter', () => {
it('renders a radio button for each filterOption', () => {
expect(findGlRadioButtonsText()).toStrictEqual(
confidentialFilterData.filterByScope[confidentialFilterData.scopes.ISSUES].map(f => {
confidentialFilterData.filterByScope[confidentialFilterData.scopes.ISSUES].map((f) => {
return f.value === confidentialFilterData.filters.ANY.value
? `Any ${confidentialFilterData.header.toLowerCase()}`
: f.label;
......
......@@ -15,7 +15,7 @@ describe('StatusFilter', () => {
resetQuery: jest.fn(),
};
const createComponent = initialState => {
const createComponent = (initialState) => {
const store = new Vuex.Store({
state: {
query: MOCK_QUERY,
......
......@@ -47,7 +47,7 @@ describe('Global Search Searchable Dropdown', () => {
const findGlDropdownSearch = () => findGlDropdown().find(GlSearchBoxByType);
const findDropdownText = () => findGlDropdown().find('.dropdown-toggle-text');
const findDropdownItems = () => findGlDropdown().findAll(GlDropdownItem);
const findDropdownItemsText = () => findDropdownItems().wrappers.map(w => w.text());
const findDropdownItemsText = () => findDropdownItems().wrappers.map((w) => w.text());
const findAnyDropdownItem = () => findDropdownItems().at(0);
const findFirstGroupDropdownItem = () => findDropdownItems().at(1);
const findLoader = () => wrapper.find(GlSkeletonLoader);
......@@ -94,7 +94,7 @@ describe('Global Search Searchable Dropdown', () => {
});
it('renders an instance for each namespace', () => {
const resultsIncludeAny = ['Any'].concat(MOCK_GROUPS.map(n => n.full_name));
const resultsIncludeAny = ['Any'].concat(MOCK_GROUPS.map((n) => n.full_name));
expect(findDropdownItemsText()).toStrictEqual(resultsIncludeAny);
});
});
......
......@@ -32,7 +32,7 @@ describe('Search autocomplete dropdown', () => {
// Add required attributes to body before starting the test.
// section would be dashboard|group|project
const addBodyAttributes = section => {
const addBodyAttributes = (section) => {
if (section == null) {
section = 'dashboard';
}
......@@ -213,10 +213,10 @@ describe('Search autocomplete dropdown', () => {
});
function triggerAutocomplete() {
return new Promise(resolve => {
return new Promise((resolve) => {
const dropdown = widget.searchInput.data('deprecatedJQueryDropdown');
const filterCallback = dropdown.filter.options.callback;
dropdown.filter.options.callback = jest.fn(data => {
dropdown.filter.options.callback = jest.fn((data) => {
filterCallback(data);
resolve();
......@@ -227,7 +227,7 @@ describe('Search autocomplete dropdown', () => {
});
}
it('suggest Projects', done => {
it('suggest Projects', (done) => {
// eslint-disable-next-line promise/catch-or-return
triggerAutocomplete().finally(() => {
const list = widget.wrap.find('.dropdown-menu').find('ul');
......@@ -242,7 +242,7 @@ describe('Search autocomplete dropdown', () => {
jest.runOnlyPendingTimers();
});
it('suggest Groups', done => {
it('suggest Groups', (done) => {
// eslint-disable-next-line promise/catch-or-return
triggerAutocomplete().finally(() => {
const list = widget.wrap.find('.dropdown-menu').find('ul');
......
......@@ -16,7 +16,7 @@ describe('self monitor actions', () => {
});
describe('setSelfMonitor', () => {
it('commits the SET_ENABLED mutation', done => {
it('commits the SET_ENABLED mutation', (done) => {
testAction(
actions.setSelfMonitor,
null,
......@@ -29,7 +29,7 @@ describe('self monitor actions', () => {
});
describe('resetAlert', () => {
it('commits the SET_ENABLED mutation', done => {
it('commits the SET_ENABLED mutation', (done) => {
testAction(
actions.resetAlert,
null,
......@@ -54,7 +54,7 @@ describe('self monitor actions', () => {
});
});
it('dispatches status request with job data', done => {
it('dispatches status request with job data', (done) => {
testAction(
actions.requestCreateProject,
null,
......@@ -75,7 +75,7 @@ describe('self monitor actions', () => {
);
});
it('dispatches success with project path', done => {
it('dispatches success with project path', (done) => {
testAction(
actions.requestCreateProjectStatus,
null,
......@@ -98,7 +98,7 @@ describe('self monitor actions', () => {
mock.onPost(state.createProjectEndpoint).reply(500);
});
it('dispatches error', done => {
it('dispatches error', (done) => {
testAction(
actions.requestCreateProject,
null,
......@@ -121,7 +121,7 @@ describe('self monitor actions', () => {
});
describe('requestCreateProjectSuccess', () => {
it('should commit the received data', done => {
it('should commit the received data', (done) => {
testAction(
actions.requestCreateProjectSuccess,
{ project_full_path: '/self-monitor-url' },
......@@ -165,7 +165,7 @@ describe('self monitor actions', () => {
});
});
it('dispatches status request with job data', done => {
it('dispatches status request with job data', (done) => {
testAction(
actions.requestDeleteProject,
null,
......@@ -186,7 +186,7 @@ describe('self monitor actions', () => {
);
});
it('dispatches success with status', done => {
it('dispatches success with status', (done) => {
testAction(
actions.requestDeleteProjectStatus,
null,
......@@ -209,7 +209,7 @@ describe('self monitor actions', () => {
mock.onDelete(state.deleteProjectEndpoint).reply(500);
});
it('dispatches error', done => {
it('dispatches error', (done) => {
testAction(
actions.requestDeleteProject,
null,
......@@ -232,7 +232,7 @@ describe('self monitor actions', () => {
});
describe('requestDeleteProjectSuccess', () => {
it('should commit mutations to remove previously set data', done => {
it('should commit mutations to remove previously set data', (done) => {
testAction(
actions.requestDeleteProjectSuccess,
null,
......
......@@ -4,7 +4,7 @@ import SentryConfig from '~/sentry/sentry_config';
describe('SentryConfig', () => {
describe('IGNORE_ERRORS', () => {
it('should be an array of strings', () => {
const areStrings = SentryConfig.IGNORE_ERRORS.every(error => typeof error === 'string');
const areStrings = SentryConfig.IGNORE_ERRORS.every((error) => typeof error === 'string');
expect(areStrings).toBe(true);
});
......@@ -12,7 +12,7 @@ describe('SentryConfig', () => {
describe('BLACKLIST_URLS', () => {
it('should be an array of regexps', () => {
const areRegExps = SentryConfig.BLACKLIST_URLS.every(url => url instanceof RegExp);
const areRegExps = SentryConfig.BLACKLIST_URLS.every((url) => url instanceof RegExp);
expect(areRegExps).toBe(true);
});
......
......@@ -34,7 +34,7 @@ describe('Area component', () => {
describe('methods', () => {
describe('formatTooltipText', () => {
const mockDate = mockNormalizedMetrics.queries[0].result[0].values[0].time;
const generateSeriesData = type => ({
const generateSeriesData = (type) => ({
seriesData: [
{
componentSubType: type,
......@@ -91,7 +91,7 @@ describe('Area component', () => {
expect(
data.filter(
datum => new Date(datum.time).getTime() > 0 && typeof datum.value === 'number',
(datum) => new Date(datum.time).getTime() > 0 && typeof datum.value === 'number',
).length,
).toBe(data.length);
});
......
......@@ -7,7 +7,7 @@ import { mockServerlessFunction } from '../mock_data';
describe('functionRowComponent', () => {
let wrapper;
const createComponent = func => {
const createComponent = (func) => {
wrapper = shallowMount(functionRowComponent, {
propsData: { func },
});
......
......@@ -6,7 +6,7 @@ import missingPrometheusComponent from '~/serverless/components/missing_promethe
describe('missingPrometheusComponent', () => {
let wrapper;
const createComponent = missingData => {
const createComponent = (missingData) => {
const store = createStore({ clustersPath: '/clusters', helpPath: '/help' });
wrapper = shallowMount(missingPrometheusComponent, { store, propsData: { missingData } });
......
import { shallowMount } from '@vue/test-utils';
import podBoxComponent from '~/serverless/components/pod_box.vue';
const createComponent = count =>
const createComponent = (count) =>
shallowMount(podBoxComponent, {
propsData: {
count,
......
......@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import urlComponent from '~/serverless/components/url.vue';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
const createComponent = uri =>
const createComponent = (uri) =>
shallowMount(Vue.extend(urlComponent), {
propsData: {
uri,
......
......@@ -8,7 +8,7 @@ import { adjustMetricQuery } from '../utils';
describe('ServerlessActions', () => {
describe('fetchFunctions', () => {
it('should successfully fetch functions', done => {
it('should successfully fetch functions', (done) => {
const endpoint = '/functions';
const mock = new MockAdapter(axios);
mock.onGet(endpoint).reply(statusCodes.OK, JSON.stringify(mockServerlessFunctions));
......@@ -29,12 +29,12 @@ describe('ServerlessActions', () => {
);
});
it('should successfully retry', done => {
it('should successfully retry', (done) => {
const endpoint = '/functions';
const mock = new MockAdapter(axios);
mock
.onGet(endpoint)
.reply(() => new Promise(resolve => setTimeout(() => resolve(200), Infinity)));
.reply(() => new Promise((resolve) => setTimeout(() => resolve(200), Infinity)));
testAction(
fetchFunctions,
......@@ -51,7 +51,7 @@ describe('ServerlessActions', () => {
});
describe('fetchMetrics', () => {
it('should return no prometheus', done => {
it('should return no prometheus', (done) => {
const endpoint = '/metrics';
const mock = new MockAdapter(axios);
mock.onGet(endpoint).reply(statusCodes.NO_CONTENT);
......@@ -69,7 +69,7 @@ describe('ServerlessActions', () => {
);
});
it('should successfully fetch metrics', done => {
it('should successfully fetch metrics', (done) => {
const endpoint = '/metrics';
const mock = new MockAdapter(axios);
mock.onGet(endpoint).reply(statusCodes.OK, JSON.stringify(mockMetrics));
......
export const adjustMetricQuery = data => {
export const adjustMetricQuery = (data) => {
const updatedMetric = data.metrics;
const queries = data.metrics.queries.map(query => ({
const queries = data.metrics.queries.map((query) => ({
...query,
result: query.result.map(result => ({
result: query.result.map((result) => ({
...result,
values: result.values.map(([timestamp, value]) => ({
time: new Date(timestamp * 1000).toISOString(),
......
......@@ -40,7 +40,7 @@ describe('SetStatusModalWrapper', () => {
};
const findModal = () => wrapper.find(GlModal);
const findFormField = field => wrapper.find(`[name="user[status][${field}]"]`);
const findFormField = (field) => wrapper.find(`[name="user[status][${field}]"]`);
const findClearStatusButton = () => wrapper.find('.js-clear-user-status-button');
const findNoEmojiPlaceholder = () => wrapper.find('.js-no-emoji-placeholder');
const findToggleEmojiButton = () => wrapper.find('.js-toggle-emoji-menu');
......
......@@ -22,14 +22,14 @@ describe('popover', () => {
expect(togglePopover.call(context, true)).toEqual(false);
});
it('shows popover', done => {
it('shows popover', (done) => {
const context = {
hasClass: () => false,
popover: () => {},
toggleClass: () => {},
};
jest.spyOn(context, 'popover').mockImplementation(method => {
jest.spyOn(context, 'popover').mockImplementation((method) => {
expect(method).toEqual('show');
done();
});
......@@ -37,7 +37,7 @@ describe('popover', () => {
togglePopover.call(context, true);
});
it('adds disable-animation and js-popover-show class', done => {
it('adds disable-animation and js-popover-show class', (done) => {
const context = {
hasClass: () => false,
popover: () => {},
......@@ -73,14 +73,14 @@ describe('popover', () => {
expect(togglePopover.call(context, false)).toEqual(false);
});
it('hides popover', done => {
it('hides popover', (done) => {
const context = {
hasClass: () => true,
popover: () => {},
toggleClass: () => {},
};
jest.spyOn(context, 'popover').mockImplementation(method => {
jest.spyOn(context, 'popover').mockImplementation((method) => {
expect(method).toEqual('hide');
done();
});
......@@ -88,7 +88,7 @@ describe('popover', () => {
togglePopover.call(context, false);
});
it('removes disable-animation and js-popover-show class', done => {
it('removes disable-animation and js-popover-show class', (done) => {
const context = {
hasClass: () => true,
popover: () => {},
......@@ -114,7 +114,7 @@ describe('popover', () => {
jest
.spyOn($.fn, 'init')
.mockImplementation(selector => (selector === '.popover:hover' ? fakeJquery : $.fn));
.mockImplementation((selector) => (selector === '.popover:hover' ? fakeJquery : $.fn));
jest.spyOn(togglePopover, 'call').mockImplementation(() => {});
mouseleave();
......@@ -128,7 +128,7 @@ describe('popover', () => {
jest
.spyOn($.fn, 'init')
.mockImplementation(selector => (selector === '.popover:hover' ? fakeJquery : $.fn));
.mockImplementation((selector) => (selector === '.popover:hover' ? fakeJquery : $.fn));
jest.spyOn(togglePopover, 'call').mockImplementation(() => {});
mouseleave();
......@@ -146,9 +146,9 @@ describe('popover', () => {
expect(togglePopover.call).toHaveBeenCalledWith(expect.any(Object), true);
});
it('registers mouseleave event if popover is showed', done => {
it('registers mouseleave event if popover is showed', (done) => {
jest.spyOn(togglePopover, 'call').mockReturnValue(true);
jest.spyOn($.fn, 'on').mockImplementation(eventName => {
jest.spyOn($.fn, 'on').mockImplementation((eventName) => {
expect(eventName).toEqual('mouseleave');
done();
});
......
......@@ -85,13 +85,13 @@ describe('Shortcuts', () => {
});
it('attaches a Mousetrap handler for every markdown shortcut specified with md-shortcuts', () => {
const expectedCalls = shortcuts.map(s => [s, expect.any(Function)]);
const expectedCalls = shortcuts.map((s) => [s, expect.any(Function)]);
expect(mockMousetrap.bind.mock.calls).toEqual(expectedCalls);
});
it('attaches a stopCallback that allows each markdown shortcut specified with md-shortcuts', () => {
flatten(shortcuts).forEach(s => {
flatten(shortcuts).forEach((s) => {
expect(mockMousetrap.stopCallback(null, null, s)).toBe(false);
});
});
......@@ -108,7 +108,7 @@ describe('Shortcuts', () => {
Shortcuts.initMarkdownEditorShortcuts($('.edit-note textarea'));
Shortcuts.removeMarkdownEditorShortcuts($('.edit-note textarea'));
const expectedCalls = shortcuts.map(s => [s]);
const expectedCalls = shortcuts.map((s) => [s]);
expect(mockMousetrap.unbind.mock.calls).toEqual(expectedCalls);
});
......
......@@ -6,7 +6,7 @@ import Component from '~/sidebar/components/assignees/assignee_title.vue';
describe('AssigneeTitle component', () => {
let wrapper;
const createComponent = props => {
const createComponent = (props) => {
return shallowMount(Component, {
propsData: {
numberOfAssignees: 0,
......
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