Commit d4a8b730 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 41 files - 64 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
...@@ -107,7 +107,7 @@ describe('Actions menu', () => { ...@@ -107,7 +107,7 @@ describe('Actions menu', () => {
describe('adding new metric from modal', () => { describe('adding new metric from modal', () => {
let origPage; let origPage;
beforeEach(done => { beforeEach((done) => {
jest.spyOn(Tracking, 'event').mockReturnValue(); jest.spyOn(Tracking, 'event').mockReturnValue();
createShallowWrapper(); createShallowWrapper();
...@@ -123,7 +123,7 @@ describe('Actions menu', () => { ...@@ -123,7 +123,7 @@ describe('Actions menu', () => {
document.body.dataset.page = origPage; document.body.dataset.page = origPage;
}); });
it('is tracked', done => { it('is tracked', (done) => {
const submitButton = findAddMetricModalSubmitButton().vm; const submitButton = findAddMetricModalSubmitButton().vm;
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
...@@ -219,7 +219,7 @@ describe('Actions menu', () => { ...@@ -219,7 +219,7 @@ describe('Actions menu', () => {
}); });
}); });
describe.each(ootbDashboards)('when current dashboard is OOTB', dashboard => { describe.each(ootbDashboards)('when current dashboard is OOTB', (dashboard) => {
beforeEach(() => { beforeEach(() => {
setupAllDashboards(store, dashboard.path); setupAllDashboards(store, dashboard.path);
}); });
...@@ -240,7 +240,7 @@ describe('Actions menu', () => { ...@@ -240,7 +240,7 @@ describe('Actions menu', () => {
createShallowWrapper(); createShallowWrapper();
}); });
describe.each(ootbDashboards)('when current dashboard is OOTB', dashboard => { describe.each(ootbDashboards)('when current dashboard is OOTB', (dashboard) => {
beforeEach(() => { beforeEach(() => {
setupAllDashboards(store, dashboard.path); setupAllDashboards(store, dashboard.path);
}); });
......
...@@ -41,7 +41,7 @@ describe('Dashboard header', () => { ...@@ -41,7 +41,7 @@ describe('Dashboard header', () => {
const findActionsMenu = () => wrapper.find(ActionsMenu); const findActionsMenu = () => wrapper.find(ActionsMenu);
const setSearchTerm = searchTerm => { const setSearchTerm = (searchTerm) => {
store.commit(`monitoringDashboard/${types.SET_ENVIRONMENTS_FILTER}`, searchTerm); store.commit(`monitoringDashboard/${types.SET_ENVIRONMENTS_FILTER}`, searchTerm);
}; };
...@@ -147,13 +147,13 @@ describe('Dashboard header', () => { ...@@ -147,13 +147,13 @@ describe('Dashboard header', () => {
it('environments dropdown items can be checked', () => { it('environments dropdown items can be checked', () => {
const items = findEnvsDropdownItems(); const items = findEnvsDropdownItems();
const checkItems = findEnvsDropdownItems().filter(item => item.props('isCheckItem')); const checkItems = findEnvsDropdownItems().filter((item) => item.props('isCheckItem'));
expect(items).toHaveLength(checkItems.length); expect(items).toHaveLength(checkItems.length);
}); });
it('checks the currently selected environment', () => { it('checks the currently selected environment', () => {
const selectedItems = findEnvsDropdownItems().filter(item => item.props('isChecked')); const selectedItems = findEnvsDropdownItems().filter((item) => item.props('isChecked'));
expect(selectedItems).toHaveLength(1); expect(selectedItems).toHaveLength(1);
expect(selectedItems.at(0).text()).toBe(currentEnvironmentName); expect(selectedItems.at(0).text()).toBe(currentEnvironmentName);
...@@ -218,7 +218,7 @@ describe('Dashboard header', () => { ...@@ -218,7 +218,7 @@ describe('Dashboard header', () => {
}); });
describe('timezone setting', () => { describe('timezone setting', () => {
const setupWithTimezone = value => { const setupWithTimezone = (value) => {
store = createStore({ dashboardTimezone: value }); store = createStore({ dashboardTimezone: value });
createShallowWrapper(); createShallowWrapper();
}; };
...@@ -295,7 +295,7 @@ describe('Dashboard header', () => { ...@@ -295,7 +295,7 @@ describe('Dashboard header', () => {
}); });
describe('adding metrics prop', () => { describe('adding metrics prop', () => {
it.each(ootbDashboards)('gets passed true if current dashboard is OOTB', dashboardPath => { it.each(ootbDashboards)('gets passed true if current dashboard is OOTB', (dashboardPath) => {
createShallowWrapper({ customMetricsAvailable: true }); createShallowWrapper({ customMetricsAvailable: true });
store.state.monitoringDashboard.emptyState = false; store.state.monitoringDashboard.emptyState = false;
...@@ -308,7 +308,7 @@ describe('Dashboard header', () => { ...@@ -308,7 +308,7 @@ describe('Dashboard header', () => {
it.each(customDashboards)( it.each(customDashboards)(
'gets passed false if current dashboard is custom', 'gets passed false if current dashboard is custom',
dashboardPath => { (dashboardPath) => {
createShallowWrapper({ customMetricsAvailable: true }); createShallowWrapper({ customMetricsAvailable: true });
store.state.monitoringDashboard.emptyState = false; store.state.monitoringDashboard.emptyState = false;
......
...@@ -57,7 +57,7 @@ describe('Dashboard Panel', () => { ...@@ -57,7 +57,7 @@ describe('Dashboard Panel', () => {
const findTitle = () => wrapper.find({ ref: 'graphTitle' }); const findTitle = () => wrapper.find({ ref: 'graphTitle' });
const findCtxMenu = () => wrapper.find({ ref: 'contextualMenu' }); const findCtxMenu = () => wrapper.find({ ref: 'contextualMenu' });
const findMenuItems = () => wrapper.findAll(GlDropdownItem); const findMenuItems = () => wrapper.findAll(GlDropdownItem);
const findMenuItemByText = text => findMenuItems().filter(i => i.text() === text); const findMenuItemByText = (text) => findMenuItems().filter((i) => i.text() === text);
const findAlertsWidget = () => wrapper.find(AlertWidget); const findAlertsWidget = () => wrapper.find(AlertWidget);
const createWrapper = (props, { mountFn = shallowMount, ...options } = {}) => { const createWrapper = (props, { mountFn = shallowMount, ...options } = {}) => {
...@@ -82,7 +82,7 @@ describe('Dashboard Panel', () => { ...@@ -82,7 +82,7 @@ describe('Dashboard Panel', () => {
}); });
}; };
const setMetricsSavedToDb = val => const setMetricsSavedToDb = (val) =>
monitoringDashboard.getters.metricsSavedToDb.mockReturnValue(val); monitoringDashboard.getters.metricsSavedToDb.mockReturnValue(val);
beforeEach(() => { beforeEach(() => {
...@@ -214,7 +214,7 @@ describe('Dashboard Panel', () => { ...@@ -214,7 +214,7 @@ describe('Dashboard Panel', () => {
}); });
describe('Supports different panel types', () => { describe('Supports different panel types', () => {
const dataWithType = type => { const dataWithType = (type) => {
return { return {
...graphData, ...graphData,
type, type,
......
...@@ -126,7 +126,7 @@ describe('Dashboard', () => { ...@@ -126,7 +126,7 @@ describe('Dashboard', () => {
}); });
describe('panel containers layout', () => { describe('panel containers layout', () => {
const findPanelLayoutWrapperAt = index => { const findPanelLayoutWrapperAt = (index) => {
return wrapper return wrapper
.find(GraphGroup) .find(GraphGroup)
.findAll('[data-testid="dashboard-panel-layout-wrapper"]') .findAll('[data-testid="dashboard-panel-layout-wrapper"]')
...@@ -225,7 +225,7 @@ describe('Dashboard', () => { ...@@ -225,7 +225,7 @@ describe('Dashboard', () => {
describe('when the URL contains a reference to a panel', () => { describe('when the URL contains a reference to a panel', () => {
let location; let location;
const setSearch = search => { const setSearch = (search) => {
window.location = { ...location, search }; window.location = { ...location, search };
}; };
...@@ -391,7 +391,7 @@ describe('Dashboard', () => { ...@@ -391,7 +391,7 @@ describe('Dashboard', () => {
}); });
describe('when all panels in the first group are loading', () => { describe('when all panels in the first group are loading', () => {
const findGroupAt = i => wrapper.findAll(GraphGroup).at(i); const findGroupAt = (i) => wrapper.findAll(GraphGroup).at(i);
beforeEach(() => { beforeEach(() => {
setupStoreWithDashboard(store); setupStoreWithDashboard(store);
...@@ -434,7 +434,7 @@ describe('Dashboard', () => { ...@@ -434,7 +434,7 @@ describe('Dashboard', () => {
setupStoreWithData(store); setupStoreWithData(store);
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
wrapper.findAll(GraphGroup).wrappers.forEach(groupWrapper => { wrapper.findAll(GraphGroup).wrappers.forEach((groupWrapper) => {
expect(groupWrapper.props('isLoading')).toBe(false); expect(groupWrapper.props('isLoading')).toBe(false);
}); });
}); });
...@@ -505,7 +505,7 @@ describe('Dashboard', () => { ...@@ -505,7 +505,7 @@ describe('Dashboard', () => {
let group; let group;
let panel; let panel;
const mockKeyup = key => window.dispatchEvent(new KeyboardEvent('keyup', { key })); const mockKeyup = (key) => window.dispatchEvent(new KeyboardEvent('keyup', { key }));
const MockPanel = { const MockPanel = {
template: `<div><slot name="top-left"/></div>`, template: `<div><slot name="top-left"/></div>`,
...@@ -532,7 +532,7 @@ describe('Dashboard', () => { ...@@ -532,7 +532,7 @@ describe('Dashboard', () => {
it('displays a single panel and others are hidden', () => { it('displays a single panel and others are hidden', () => {
const panels = wrapper.findAll(MockPanel); const panels = wrapper.findAll(MockPanel);
const visiblePanels = panels.filter(w => w.isVisible()); const visiblePanels = panels.filter((w) => w.isVisible());
expect(findExpandedPanel().isVisible()).toBe(true); expect(findExpandedPanel().isVisible()).toBe(true);
// v-show for hiding panels is more performant than v-if // v-show for hiding panels is more performant than v-if
...@@ -595,7 +595,7 @@ describe('Dashboard', () => { ...@@ -595,7 +595,7 @@ describe('Dashboard', () => {
describe('drag and drop function', () => { describe('drag and drop function', () => {
const findDraggables = () => wrapper.findAll(VueDraggable); const findDraggables = () => wrapper.findAll(VueDraggable);
const findEnabledDraggables = () => findDraggables().filter(f => !f.attributes('disabled')); const findEnabledDraggables = () => findDraggables().filter((f) => !f.attributes('disabled'));
const findDraggablePanels = () => wrapper.findAll('.js-draggable-panel'); const findDraggablePanels = () => wrapper.findAll('.js-draggable-panel');
const findRearrangeButton = () => wrapper.find('.js-rearrange-button'); const findRearrangeButton = () => wrapper.find('.js-rearrange-button');
......
...@@ -34,11 +34,11 @@ describe('DashboardsDropdown', () => { ...@@ -34,11 +34,11 @@ describe('DashboardsDropdown', () => {
} }
const findItems = () => wrapper.findAll(GlDropdownItem); const findItems = () => wrapper.findAll(GlDropdownItem);
const findItemAt = i => wrapper.findAll(GlDropdownItem).at(i); const findItemAt = (i) => wrapper.findAll(GlDropdownItem).at(i);
const findSearchInput = () => wrapper.find({ ref: 'monitorDashboardsDropdownSearch' }); const findSearchInput = () => wrapper.find({ ref: 'monitorDashboardsDropdownSearch' });
const findNoItemsMsg = () => wrapper.find({ ref: 'monitorDashboardsDropdownMsg' }); const findNoItemsMsg = () => wrapper.find({ ref: 'monitorDashboardsDropdownMsg' });
const findStarredListDivider = () => wrapper.find({ ref: 'starredListDivider' }); const findStarredListDivider = () => wrapper.find({ ref: 'starredListDivider' });
const setSearchTerm = searchTerm => wrapper.setData({ searchTerm }); const setSearchTerm = (searchTerm) => wrapper.setData({ searchTerm });
beforeEach(() => { beforeEach(() => {
mockDashboards = dashboardGitResponse; mockDashboards = dashboardGitResponse;
...@@ -105,7 +105,7 @@ describe('DashboardsDropdown', () => { ...@@ -105,7 +105,7 @@ describe('DashboardsDropdown', () => {
describe('when the dashboard is missing a display name', () => { describe('when the dashboard is missing a display name', () => {
beforeEach(() => { beforeEach(() => {
mockDashboards = dashboardGitResponse.map(d => ({ ...d, display_name: undefined })); mockDashboards = dashboardGitResponse.map((d) => ({ ...d, display_name: undefined }));
createComponent(); createComponent();
}); });
......
...@@ -18,11 +18,11 @@ const createMountedWrapper = (props = {}) => { ...@@ -18,11 +18,11 @@ const createMountedWrapper = (props = {}) => {
describe('DuplicateDashboardForm', () => { describe('DuplicateDashboardForm', () => {
const defaultBranch = 'master'; const defaultBranch = 'master';
const findByRef = ref => wrapper.find({ ref }); const findByRef = (ref) => wrapper.find({ ref });
const setValue = (ref, val) => { const setValue = (ref, val) => {
findByRef(ref).setValue(val); findByRef(ref).setValue(val);
}; };
const setChecked = value => { const setChecked = (value) => {
const input = wrapper.find(`.form-check-input[value="${value}"]`); const input = wrapper.find(`.form-check-input[value="${value}"]`);
input.element.checked = true; input.element.checked = true;
input.trigger('click'); input.trigger('click');
......
...@@ -76,7 +76,7 @@ describe('Embed Group', () => { ...@@ -76,7 +76,7 @@ describe('Embed Group', () => {
expect(wrapper.find('.gl-card-body').classes()).not.toContain('d-none'); expect(wrapper.find('.gl-card-body').classes()).not.toContain('d-none');
}); });
it('collapses when clicked', done => { it('collapses when clicked', (done) => {
metricsWithDataGetter.mockReturnValue([1]); metricsWithDataGetter.mockReturnValue([1]);
mountComponent({ shallow: false, stubs: { MetricEmbed: true } }); mountComponent({ shallow: false, stubs: { MetricEmbed: true } });
...@@ -134,7 +134,7 @@ describe('Embed Group', () => { ...@@ -134,7 +134,7 @@ describe('Embed Group', () => {
}); });
it('passes the correct props to the Embed components', () => { it('passes the correct props to the Embed components', () => {
expect(wrapper.findAll(MetricEmbed).wrappers.map(item => item.props())).toEqual( expect(wrapper.findAll(MetricEmbed).wrappers.map((item) => item.props())).toEqual(
multipleEmbedProps(), multipleEmbedProps(),
); );
}); });
......
...@@ -11,7 +11,7 @@ describe('Graph group component', () => { ...@@ -11,7 +11,7 @@ describe('Graph group component', () => {
const findCaretIcon = () => wrapper.find(GlIcon); const findCaretIcon = () => wrapper.find(GlIcon);
const findToggleButton = () => wrapper.find('[data-testid="group-toggle-button"]'); const findToggleButton = () => wrapper.find('[data-testid="group-toggle-button"]');
const createComponent = propsData => { const createComponent = (propsData) => {
wrapper = shallowMount(GraphGroup, { wrapper = shallowMount(GraphGroup, {
propsData, propsData,
}); });
......
...@@ -35,7 +35,7 @@ describe('GroupEmptyState', () => { ...@@ -35,7 +35,7 @@ describe('GroupEmptyState', () => {
metricStates.LOADING, metricStates.LOADING,
metricStates.UNKNOWN_ERROR, metricStates.UNKNOWN_ERROR,
'FOO STATE', // does not fail with unknown states 'FOO STATE', // does not fail with unknown states
])('given state %s', selectedState => { ])('given state %s', (selectedState) => {
beforeEach(() => { beforeEach(() => {
wrapper = createComponent({ selectedState }); wrapper = createComponent({ selectedState });
}); });
......
...@@ -12,7 +12,7 @@ describe('Links Section component', () => { ...@@ -12,7 +12,7 @@ describe('Links Section component', () => {
store, store,
}); });
}; };
const setState = links => { const setState = (links) => {
store.state.monitoringDashboard = { store.state.monitoringDashboard = {
...store.state.monitoringDashboard, ...store.state.monitoringDashboard,
emptyState: null, emptyState: null,
......
...@@ -17,9 +17,9 @@ describe('RefreshButton', () => { ...@@ -17,9 +17,9 @@ describe('RefreshButton', () => {
const findRefreshBtn = () => wrapper.find(GlButton); const findRefreshBtn = () => wrapper.find(GlButton);
const findDropdown = () => wrapper.find(GlDropdown); const findDropdown = () => wrapper.find(GlDropdown);
const findOptions = () => findDropdown().findAll(GlDropdownItem); const findOptions = () => findDropdown().findAll(GlDropdownItem);
const findOptionAt = index => findOptions().at(index); const findOptionAt = (index) => findOptions().at(index);
const expectFetchDataToHaveBeenCalledTimes = times => { const expectFetchDataToHaveBeenCalledTimes = (times) => {
const refreshCalls = dispatch.mock.calls.filter(([action, payload]) => { const refreshCalls = dispatch.mock.calls.filter(([action, payload]) => {
return action === 'monitoringDashboard/fetchDashboardData' && payload === undefined; return action === 'monitoringDashboard/fetchDashboardData' && payload === undefined;
}); });
......
...@@ -17,7 +17,7 @@ describe('Custom variable component', () => { ...@@ -17,7 +17,7 @@ describe('Custom variable component', () => {
}, },
}; };
const createShallowWrapper = props => { const createShallowWrapper = (props) => {
wrapper = shallowMount(DropdownField, { wrapper = shallowMount(DropdownField, {
propsData: { propsData: {
...defaultProps, ...defaultProps,
......
...@@ -35,7 +35,7 @@ const firstPanel = metricsDashboardViewModel.panelGroups[0].panels[0]; ...@@ -35,7 +35,7 @@ const firstPanel = metricsDashboardViewModel.panelGroups[0].panels[0];
export const graphData = { export const graphData = {
...firstPanel, ...firstPanel,
metrics: firstPanel.metrics.map(metric => ({ metrics: firstPanel.metrics.map((metric) => ({
...metric, ...metric,
result: metricsResult, result: metricsResult,
state: metricStates.OK, state: metricStates.OK,
...@@ -44,7 +44,7 @@ export const graphData = { ...@@ -44,7 +44,7 @@ export const graphData = {
export const graphDataEmpty = { export const graphDataEmpty = {
...firstPanel, ...firstPanel,
metrics: firstPanel.metrics.map(metric => ({ metrics: firstPanel.metrics.map((metric) => ({
...metric, ...metric,
result: [], result: [],
state: metricStates.NO_DATA, state: metricStates.NO_DATA,
......
...@@ -4,8 +4,8 @@ import { panelTypes, metricStates } from '~/monitoring/constants'; ...@@ -4,8 +4,8 @@ import { panelTypes, metricStates } from '~/monitoring/constants';
const initTime = 1435781450; // "Wed, 01 Jul 2015 20:10:50 GMT" const initTime = 1435781450; // "Wed, 01 Jul 2015 20:10:50 GMT"
const intervalSeconds = 120; const intervalSeconds = 120;
const makeValue = val => [initTime, val]; const makeValue = (val) => [initTime, val];
const makeValues = vals => vals.map((val, i) => [initTime + intervalSeconds * i, val]); const makeValues = (vals) => vals.map((val, i) => [initTime + intervalSeconds * i, val]);
// Raw Promethues Responses // Raw Promethues Responses
......
...@@ -31,7 +31,7 @@ describe('monitoring metrics_requests', () => { ...@@ -31,7 +31,7 @@ describe('monitoring metrics_requests', () => {
it('returns a dashboard response', () => { it('returns a dashboard response', () => {
mock.onGet(dashboardEndpoint).reply(statusCodes.OK, response); mock.onGet(dashboardEndpoint).reply(statusCodes.OK, response);
return getDashboard(dashboardEndpoint, params).then(data => { return getDashboard(dashboardEndpoint, params).then((data) => {
expect(data).toEqual(metricsDashboardResponse); expect(data).toEqual(metricsDashboardResponse);
}); });
}); });
...@@ -41,7 +41,7 @@ describe('monitoring metrics_requests', () => { ...@@ -41,7 +41,7 @@ describe('monitoring metrics_requests', () => {
mock.onGet(dashboardEndpoint).replyOnce(statusCodes.NO_CONTENT); mock.onGet(dashboardEndpoint).replyOnce(statusCodes.NO_CONTENT);
mock.onGet(dashboardEndpoint).reply(statusCodes.OK, response); mock.onGet(dashboardEndpoint).reply(statusCodes.OK, response);
return getDashboard(dashboardEndpoint, params).then(data => { return getDashboard(dashboardEndpoint, params).then((data) => {
expect(data).toEqual(metricsDashboardResponse); expect(data).toEqual(metricsDashboardResponse);
expect(mock.history.get).toHaveLength(3); expect(mock.history.get).toHaveLength(3);
}); });
...@@ -50,7 +50,7 @@ describe('monitoring metrics_requests', () => { ...@@ -50,7 +50,7 @@ describe('monitoring metrics_requests', () => {
it('rejects after getting an error', () => { it('rejects after getting an error', () => {
mock.onGet(dashboardEndpoint).reply(500); mock.onGet(dashboardEndpoint).reply(500);
return getDashboard(dashboardEndpoint, params).catch(error => { return getDashboard(dashboardEndpoint, params).catch((error) => {
expect(error).toEqual(expect.any(Error)); expect(error).toEqual(expect.any(Error));
expect(mock.history.get).toHaveLength(1); expect(mock.history.get).toHaveLength(1);
}); });
...@@ -74,7 +74,7 @@ describe('monitoring metrics_requests', () => { ...@@ -74,7 +74,7 @@ describe('monitoring metrics_requests', () => {
it('returns a dashboard response', () => { it('returns a dashboard response', () => {
mock.onGet(prometheusEndpoint).reply(statusCodes.OK, response); mock.onGet(prometheusEndpoint).reply(statusCodes.OK, response);
return getPrometheusQueryData(prometheusEndpoint, params).then(data => { return getPrometheusQueryData(prometheusEndpoint, params).then((data) => {
expect(data).toEqual(response.data); expect(data).toEqual(response.data);
}); });
}); });
...@@ -85,7 +85,7 @@ describe('monitoring metrics_requests', () => { ...@@ -85,7 +85,7 @@ describe('monitoring metrics_requests', () => {
mock.onGet(prometheusEndpoint).replyOnce(statusCodes.NO_CONTENT); mock.onGet(prometheusEndpoint).replyOnce(statusCodes.NO_CONTENT);
mock.onGet(prometheusEndpoint).reply(statusCodes.OK, response); // 3rd attempt mock.onGet(prometheusEndpoint).reply(statusCodes.OK, response); // 3rd attempt
return getPrometheusQueryData(prometheusEndpoint, params).then(data => { return getPrometheusQueryData(prometheusEndpoint, params).then((data) => {
expect(data).toEqual(response.data); expect(data).toEqual(response.data);
expect(mock.history.get).toHaveLength(3); expect(mock.history.get).toHaveLength(3);
}); });
...@@ -97,7 +97,7 @@ describe('monitoring metrics_requests', () => { ...@@ -97,7 +97,7 @@ describe('monitoring metrics_requests', () => {
error: 'An error ocurred', error: 'An error ocurred',
}); });
return getPrometheusQueryData(prometheusEndpoint, params).catch(error => { return getPrometheusQueryData(prometheusEndpoint, params).catch((error) => {
expect(error).toEqual(new Error('Request failed with status code 500')); expect(error).toEqual(new Error('Request failed with status code 500'));
}); });
}); });
...@@ -109,7 +109,7 @@ describe('monitoring metrics_requests', () => { ...@@ -109,7 +109,7 @@ describe('monitoring metrics_requests', () => {
error: 'An error ocurred', error: 'An error ocurred',
}); });
return getPrometheusQueryData(prometheusEndpoint, params).catch(error => { return getPrometheusQueryData(prometheusEndpoint, params).catch((error) => {
expect(error).toEqual(new Error('Request failed with status code 401')); expect(error).toEqual(new Error('Request failed with status code 401'));
}); });
}); });
...@@ -123,7 +123,7 @@ describe('monitoring metrics_requests', () => { ...@@ -123,7 +123,7 @@ describe('monitoring metrics_requests', () => {
error: 'An error ocurred', error: 'An error ocurred',
}); // 3rd attempt }); // 3rd attempt
return getPrometheusQueryData(prometheusEndpoint, params).catch(error => { return getPrometheusQueryData(prometheusEndpoint, params).catch((error) => {
expect(error).toEqual(new Error('Request failed with status code 500')); expect(error).toEqual(new Error('Request failed with status code 500'));
expect(mock.history.get).toHaveLength(3); expect(mock.history.get).toHaveLength(3);
}); });
...@@ -140,7 +140,7 @@ describe('monitoring metrics_requests', () => { ...@@ -140,7 +140,7 @@ describe('monitoring metrics_requests', () => {
error: reason, error: reason,
}); });
return getPrometheusQueryData(prometheusEndpoint, params).catch(error => { return getPrometheusQueryData(prometheusEndpoint, params).catch((error) => {
expect(error).toEqual(new Error(reason)); expect(error).toEqual(new Error(reason));
expect(mock.history.get).toHaveLength(1); expect(mock.history.get).toHaveLength(1);
}); });
......
...@@ -88,7 +88,7 @@ describe('Monitoring store actions', () => { ...@@ -88,7 +88,7 @@ describe('Monitoring store actions', () => {
// Setup // Setup
describe('setGettingStartedEmptyState', () => { describe('setGettingStartedEmptyState', () => {
it('should commit SET_GETTING_STARTED_EMPTY_STATE mutation', done => { it('should commit SET_GETTING_STARTED_EMPTY_STATE mutation', (done) => {
testAction( testAction(
setGettingStartedEmptyState, setGettingStartedEmptyState,
null, null,
...@@ -105,7 +105,7 @@ describe('Monitoring store actions', () => { ...@@ -105,7 +105,7 @@ describe('Monitoring store actions', () => {
}); });
describe('setInitialState', () => { describe('setInitialState', () => {
it('should commit SET_INITIAL_STATE mutation', done => { it('should commit SET_INITIAL_STATE mutation', (done) => {
testAction( testAction(
setInitialState, setInitialState,
{ {
...@@ -233,7 +233,7 @@ describe('Monitoring store actions', () => { ...@@ -233,7 +233,7 @@ describe('Monitoring store actions', () => {
}; };
}); });
it('dispatches a failure', done => { it('dispatches a failure', (done) => {
result() result()
.then(() => { .then(() => {
expect(commit).toHaveBeenCalledWith( expect(commit).toHaveBeenCalledWith(
...@@ -250,7 +250,7 @@ describe('Monitoring store actions', () => { ...@@ -250,7 +250,7 @@ describe('Monitoring store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('dispatches a failure action when a message is returned', done => { it('dispatches a failure action when a message is returned', (done) => {
result() result()
.then(() => { .then(() => {
expect(dispatch).toHaveBeenCalledWith( expect(dispatch).toHaveBeenCalledWith(
...@@ -265,7 +265,7 @@ describe('Monitoring store actions', () => { ...@@ -265,7 +265,7 @@ describe('Monitoring store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not show a flash error when showErrorBanner is disabled', done => { it('does not show a flash error when showErrorBanner is disabled', (done) => {
state.showErrorBanner = false; state.showErrorBanner = false;
result() result()
...@@ -322,7 +322,7 @@ describe('Monitoring store actions', () => { ...@@ -322,7 +322,7 @@ describe('Monitoring store actions', () => {
state.timeRange = defaultTimeRange; state.timeRange = defaultTimeRange;
}); });
it('commits empty state when state.groups is empty', done => { it('commits empty state when state.groups is empty', (done) => {
const localGetters = { const localGetters = {
metricsWithData: () => [], metricsWithData: () => [],
}; };
...@@ -353,7 +353,7 @@ describe('Monitoring store actions', () => { ...@@ -353,7 +353,7 @@ describe('Monitoring store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('dispatches fetchPrometheusMetric for each panel query', done => { it('dispatches fetchPrometheusMetric for each panel query', (done) => {
state.dashboard.panelGroups = convertObjectPropsToCamelCase( state.dashboard.panelGroups = convertObjectPropsToCamelCase(
metricsDashboardResponse.dashboard.panel_groups, metricsDashboardResponse.dashboard.panel_groups,
); );
...@@ -390,7 +390,7 @@ describe('Monitoring store actions', () => { ...@@ -390,7 +390,7 @@ describe('Monitoring store actions', () => {
done(); done();
}); });
it('dispatches fetchPrometheusMetric for each panel query, handles an error', done => { it('dispatches fetchPrometheusMetric for each panel query, handles an error', (done) => {
state.dashboard.panelGroups = metricsDashboardViewModel.panelGroups; state.dashboard.panelGroups = metricsDashboardViewModel.panelGroups;
const metric = state.dashboard.panelGroups[0].panels[0].metrics[0]; const metric = state.dashboard.panelGroups[0].panels[0].metrics[0];
...@@ -449,7 +449,7 @@ describe('Monitoring store actions', () => { ...@@ -449,7 +449,7 @@ describe('Monitoring store actions', () => {
}; };
}); });
it('commits result', done => { it('commits result', (done) => {
mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt
testAction( testAction(
...@@ -485,7 +485,7 @@ describe('Monitoring store actions', () => { ...@@ -485,7 +485,7 @@ describe('Monitoring store actions', () => {
step: 60, step: 60,
}; };
it('uses calculated step', done => { it('uses calculated step', (done) => {
mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt
testAction( testAction(
...@@ -527,7 +527,7 @@ describe('Monitoring store actions', () => { ...@@ -527,7 +527,7 @@ describe('Monitoring store actions', () => {
step: 7, step: 7,
}; };
it('uses metric step', done => { it('uses metric step', (done) => {
mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt mock.onGet(prometheusEndpointPath).reply(200, { data }); // One attempt
testAction( testAction(
...@@ -558,7 +558,7 @@ describe('Monitoring store actions', () => { ...@@ -558,7 +558,7 @@ describe('Monitoring store actions', () => {
}); });
}); });
it('commits failure, when waiting for results and getting a server error', done => { it('commits failure, when waiting for results and getting a server error', (done) => {
mock.onGet(prometheusEndpointPath).reply(500); mock.onGet(prometheusEndpointPath).reply(500);
const error = new Error('Request failed with status code 500'); const error = new Error('Request failed with status code 500');
...@@ -583,7 +583,7 @@ describe('Monitoring store actions', () => { ...@@ -583,7 +583,7 @@ describe('Monitoring store actions', () => {
}, },
], ],
[], [],
).catch(e => { ).catch((e) => {
expect(e).toEqual(error); expect(e).toEqual(error);
done(); done();
}); });
...@@ -991,7 +991,7 @@ describe('Monitoring store actions', () => { ...@@ -991,7 +991,7 @@ describe('Monitoring store actions', () => {
state.dashboardsEndpoint = '/dashboards.json'; state.dashboardsEndpoint = '/dashboards.json';
}); });
it('Succesful POST request resolves', done => { it('Succesful POST request resolves', (done) => {
mock.onPost(state.dashboardsEndpoint).reply(statusCodes.CREATED, { mock.onPost(state.dashboardsEndpoint).reply(statusCodes.CREATED, {
dashboard: dashboardGitResponse[1], dashboard: dashboardGitResponse[1],
}); });
...@@ -1004,7 +1004,7 @@ describe('Monitoring store actions', () => { ...@@ -1004,7 +1004,7 @@ describe('Monitoring store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('Succesful POST request resolves to a dashboard', done => { it('Succesful POST request resolves to a dashboard', (done) => {
const mockCreatedDashboard = dashboardGitResponse[1]; const mockCreatedDashboard = dashboardGitResponse[1];
const params = { const params = {
...@@ -1026,7 +1026,7 @@ describe('Monitoring store actions', () => { ...@@ -1026,7 +1026,7 @@ describe('Monitoring store actions', () => {
}); });
testAction(duplicateSystemDashboard, params, state, [], []) testAction(duplicateSystemDashboard, params, state, [], [])
.then(result => { .then((result) => {
expect(mock.history.post).toHaveLength(1); expect(mock.history.post).toHaveLength(1);
expect(mock.history.post[0].data).toEqual(expectedPayload); expect(mock.history.post[0].data).toEqual(expectedPayload);
expect(result).toEqual(mockCreatedDashboard); expect(result).toEqual(mockCreatedDashboard);
...@@ -1036,10 +1036,10 @@ describe('Monitoring store actions', () => { ...@@ -1036,10 +1036,10 @@ describe('Monitoring store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('Failed POST request throws an error', done => { it('Failed POST request throws an error', (done) => {
mock.onPost(state.dashboardsEndpoint).reply(statusCodes.BAD_REQUEST); mock.onPost(state.dashboardsEndpoint).reply(statusCodes.BAD_REQUEST);
testAction(duplicateSystemDashboard, {}, state, [], []).catch(err => { testAction(duplicateSystemDashboard, {}, state, [], []).catch((err) => {
expect(mock.history.post).toHaveLength(1); expect(mock.history.post).toHaveLength(1);
expect(err).toEqual(expect.any(String)); expect(err).toEqual(expect.any(String));
...@@ -1047,14 +1047,14 @@ describe('Monitoring store actions', () => { ...@@ -1047,14 +1047,14 @@ describe('Monitoring store actions', () => {
}); });
}); });
it('Failed POST request throws an error with a description', done => { it('Failed POST request throws an error with a description', (done) => {
const backendErrorMsg = 'This file already exists!'; const backendErrorMsg = 'This file already exists!';
mock.onPost(state.dashboardsEndpoint).reply(statusCodes.BAD_REQUEST, { mock.onPost(state.dashboardsEndpoint).reply(statusCodes.BAD_REQUEST, {
error: backendErrorMsg, error: backendErrorMsg,
}); });
testAction(duplicateSystemDashboard, {}, state, [], []).catch(err => { testAction(duplicateSystemDashboard, {}, state, [], []).catch((err) => {
expect(mock.history.post).toHaveLength(1); expect(mock.history.post).toHaveLength(1);
expect(err).toEqual(expect.any(String)); expect(err).toEqual(expect.any(String));
expect(err).toEqual(expect.stringContaining(backendErrorMsg)); expect(err).toEqual(expect.stringContaining(backendErrorMsg));
...@@ -1067,7 +1067,7 @@ describe('Monitoring store actions', () => { ...@@ -1067,7 +1067,7 @@ describe('Monitoring store actions', () => {
// Variables manipulation // Variables manipulation
describe('updateVariablesAndFetchData', () => { describe('updateVariablesAndFetchData', () => {
it('should commit UPDATE_VARIABLE_VALUE mutation and fetch data', done => { it('should commit UPDATE_VARIABLE_VALUE mutation and fetch data', (done) => {
testAction( testAction(
updateVariablesAndFetchData, updateVariablesAndFetchData,
{ pod: 'POD' }, { pod: 'POD' },
......
...@@ -365,7 +365,7 @@ describe('Monitoring store Getters', () => { ...@@ -365,7 +365,7 @@ describe('Monitoring store Getters', () => {
describe('selectedDashboard', () => { describe('selectedDashboard', () => {
const { selectedDashboard } = getters; const { selectedDashboard } = getters;
const localGetters = localState => ({ const localGetters = (localState) => ({
fullDashboardPath: getters.fullDashboardPath(localState), fullDashboardPath: getters.fullDashboardPath(localState),
}); });
......
...@@ -512,7 +512,7 @@ describe('Monitoring mutations', () => { ...@@ -512,7 +512,7 @@ describe('Monitoring mutations', () => {
}); });
describe('panel preview metric', () => { describe('panel preview metric', () => {
const getPreviewMetricAt = i => stateCopy.panelPreviewGraphData.metrics[i]; const getPreviewMetricAt = (i) => stateCopy.panelPreviewGraphData.metrics[i];
beforeEach(() => { beforeEach(() => {
stateCopy.panelPreviewGraphData = { stateCopy.panelPreviewGraphData = {
......
...@@ -127,7 +127,7 @@ describe('mapToDashboardViewModel', () => { ...@@ -127,7 +127,7 @@ describe('mapToDashboardViewModel', () => {
let dashboard; let dashboard;
const setupWithPanel = panel => { const setupWithPanel = (panel) => {
dashboard = { dashboard = {
panel_groups: [ panel_groups: [
{ {
...@@ -340,7 +340,7 @@ describe('mapToDashboardViewModel', () => { ...@@ -340,7 +340,7 @@ describe('mapToDashboardViewModel', () => {
], ],
}); });
const getMappedMetric = dashboard => { const getMappedMetric = (dashboard) => {
return mapToDashboardViewModel(dashboard).panelGroups[0].panels[0].metrics[0]; return mapToDashboardViewModel(dashboard).panelGroups[0].panels[0].metrics[0];
}; };
......
...@@ -15,7 +15,7 @@ export const setMetricResult = ({ store, result, group = 0, panel = 0, metric = ...@@ -15,7 +15,7 @@ export const setMetricResult = ({ store, result, group = 0, panel = 0, metric =
}); });
}; };
const setEnvironmentData = store => { const setEnvironmentData = (store) => {
store.commit(`monitoringDashboard/${types.RECEIVE_ENVIRONMENTS_DATA_SUCCESS}`, environmentData); store.commit(`monitoringDashboard/${types.RECEIVE_ENVIRONMENTS_DATA_SUCCESS}`, environmentData);
}; };
...@@ -28,14 +28,14 @@ export const setupAllDashboards = (store, path) => { ...@@ -28,14 +28,14 @@ export const setupAllDashboards = (store, path) => {
} }
}; };
export const setupStoreWithDashboard = store => { export const setupStoreWithDashboard = (store) => {
store.commit( store.commit(
`monitoringDashboard/${types.RECEIVE_METRICS_DASHBOARD_SUCCESS}`, `monitoringDashboard/${types.RECEIVE_METRICS_DASHBOARD_SUCCESS}`,
metricsDashboardPayload, metricsDashboardPayload,
); );
}; };
export const setupStoreWithLinks = store => { export const setupStoreWithLinks = (store) => {
store.commit(`monitoringDashboard/${types.RECEIVE_METRICS_DASHBOARD_SUCCESS}`, { store.commit(`monitoringDashboard/${types.RECEIVE_METRICS_DASHBOARD_SUCCESS}`, {
...metricsDashboardPayload, ...metricsDashboardPayload,
links: [ links: [
...@@ -47,7 +47,7 @@ export const setupStoreWithLinks = store => { ...@@ -47,7 +47,7 @@ export const setupStoreWithLinks = store => {
}); });
}; };
export const setupStoreWithData = store => { export const setupStoreWithData = (store) => {
setupAllDashboards(store); setupAllDashboards(store);
setupStoreWithDashboard(store); setupStoreWithDashboard(store);
......
...@@ -295,7 +295,7 @@ describe('monitoring/utils', () => { ...@@ -295,7 +295,7 @@ describe('monitoring/utils', () => {
${'NOT_A_GROUP'} | ${title} | ${yLabel} | ${'group'} ${'NOT_A_GROUP'} | ${title} | ${yLabel} | ${'group'}
${group} | ${'NOT_A_TITLE'} | ${yLabel} | ${'title'} ${group} | ${'NOT_A_TITLE'} | ${yLabel} | ${'title'}
${group} | ${title} | ${'NOT_A_Y_LABEL'} | ${'y_label'} ${group} | ${title} | ${'NOT_A_Y_LABEL'} | ${'y_label'}
`('throws an error when $missingField is incorrect', params => { `('throws an error when $missingField is incorrect', (params) => {
const search = `?group=${params.group}&title=${params.title}&y_label=${params.yLabel}`; const search = `?group=${params.group}&title=${params.title}&y_label=${params.yLabel}`;
expect(() => expandedPanelPayloadFromUrl(metricsDashboardViewModel, search)).toThrow(); expect(() => expandedPanelPayloadFromUrl(metricsDashboardViewModel, search)).toThrow();
}); });
...@@ -308,7 +308,7 @@ describe('monitoring/utils', () => { ...@@ -308,7 +308,7 @@ describe('monitoring/utils', () => {
const [panelGroup] = metricsDashboardViewModel.panelGroups; const [panelGroup] = metricsDashboardViewModel.panelGroups;
const [panel] = panelGroup.panels; const [panel] = panelGroup.panels;
const getUrlParams = url => urlUtils.queryToObject(url.split('?')[1]); const getUrlParams = (url) => urlUtils.queryToObject(url.split('?')[1]);
it('returns URL for a panel when query parameters are given', () => { it('returns URL for a panel when query parameters are given', () => {
const params = getUrlParams(panelToUrl(dashboard, {}, panelGroup.group, panel)); const params = getUrlParams(panelToUrl(dashboard, {}, panelGroup.group, panel));
......
...@@ -21,7 +21,7 @@ describe('Branch', () => { ...@@ -21,7 +21,7 @@ describe('Branch', () => {
beforeEach(() => { beforeEach(() => {
loadFixtures('branches/new_branch.html'); loadFixtures('branches/new_branch.html');
$('form').on('submit', e => e.preventDefault()); $('form').on('submit', (e) => e.preventDefault());
testContext.form = new NewBranchForm($('.js-create-branch-form'), []); testContext.form = new NewBranchForm($('.js-create-branch-form'), []);
}); });
......
...@@ -11,7 +11,7 @@ describe('Code component', () => { ...@@ -11,7 +11,7 @@ describe('Code component', () => {
json = getJSONFixture('blob/notebook/basic.json'); json = getJSONFixture('blob/notebook/basic.json');
}); });
const setupComponent = cell => { const setupComponent = (cell) => {
const comp = new Component({ const comp = new Component({
propsData: { propsData: {
cell, cell,
...@@ -22,7 +22,7 @@ describe('Code component', () => { ...@@ -22,7 +22,7 @@ describe('Code component', () => {
}; };
describe('without output', () => { describe('without output', () => {
beforeEach(done => { beforeEach((done) => {
vm = setupComponent(json.cells[0]); vm = setupComponent(json.cells[0]);
setImmediate(() => { setImmediate(() => {
...@@ -36,7 +36,7 @@ describe('Code component', () => { ...@@ -36,7 +36,7 @@ describe('Code component', () => {
}); });
describe('with output', () => { describe('with output', () => {
beforeEach(done => { beforeEach((done) => {
vm = setupComponent(json.cells[2]); vm = setupComponent(json.cells[2]);
setImmediate(() => { setImmediate(() => {
......
...@@ -7,7 +7,7 @@ describe('Output component', () => { ...@@ -7,7 +7,7 @@ describe('Output component', () => {
let vm; let vm;
let json; let json;
const createComponent = output => { const createComponent = (output) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
outputs: [].concat(output), outputs: [].concat(output),
...@@ -22,7 +22,7 @@ describe('Output component', () => { ...@@ -22,7 +22,7 @@ describe('Output component', () => {
}); });
describe('text output', () => { describe('text output', () => {
beforeEach(done => { beforeEach((done) => {
createComponent(json.cells[2].outputs[0]); createComponent(json.cells[2].outputs[0]);
setImmediate(() => { setImmediate(() => {
...@@ -40,7 +40,7 @@ describe('Output component', () => { ...@@ -40,7 +40,7 @@ describe('Output component', () => {
}); });
describe('image output', () => { describe('image output', () => {
beforeEach(done => { beforeEach((done) => {
createComponent(json.cells[3].outputs[0]); createComponent(json.cells[3].outputs[0]);
setImmediate(() => { setImmediate(() => {
...@@ -70,7 +70,7 @@ describe('Output component', () => { ...@@ -70,7 +70,7 @@ describe('Output component', () => {
}); });
describe('svg output', () => { describe('svg output', () => {
beforeEach(done => { beforeEach((done) => {
createComponent(json.cells[5].outputs[0]); createComponent(json.cells[5].outputs[0]);
setImmediate(() => { setImmediate(() => {
...@@ -84,7 +84,7 @@ describe('Output component', () => { ...@@ -84,7 +84,7 @@ describe('Output component', () => {
}); });
describe('default to plain text', () => { describe('default to plain text', () => {
beforeEach(done => { beforeEach((done) => {
createComponent(json.cells[6].outputs[0]); createComponent(json.cells[6].outputs[0]);
setImmediate(() => { setImmediate(() => {
...@@ -101,7 +101,7 @@ describe('Output component', () => { ...@@ -101,7 +101,7 @@ describe('Output component', () => {
expect(vm.$el.querySelector('.prompt span')).not.toBeNull(); expect(vm.$el.querySelector('.prompt span')).not.toBeNull();
}); });
it("renders as plain text when doesn't recognise other types", done => { it("renders as plain text when doesn't recognise other types", (done) => {
createComponent(json.cells[7].outputs[0]); createComponent(json.cells[7].outputs[0]);
setImmediate(() => { setImmediate(() => {
......
...@@ -7,7 +7,7 @@ describe('Prompt component', () => { ...@@ -7,7 +7,7 @@ describe('Prompt component', () => {
let vm; let vm;
describe('input', () => { describe('input', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
type: 'In', type: 'In',
...@@ -31,7 +31,7 @@ describe('Prompt component', () => { ...@@ -31,7 +31,7 @@ describe('Prompt component', () => {
}); });
describe('output', () => { describe('output', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
type: 'Out', type: 'Out',
......
...@@ -14,7 +14,7 @@ describe('Notebook component', () => { ...@@ -14,7 +14,7 @@ describe('Notebook component', () => {
}); });
describe('without JSON', () => { describe('without JSON', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
notebook: {}, notebook: {},
...@@ -33,7 +33,7 @@ describe('Notebook component', () => { ...@@ -33,7 +33,7 @@ describe('Notebook component', () => {
}); });
describe('with JSON', () => { describe('with JSON', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
notebook: json, notebook: json,
...@@ -65,7 +65,7 @@ describe('Notebook component', () => { ...@@ -65,7 +65,7 @@ describe('Notebook component', () => {
}); });
describe('with worksheets', () => { describe('with worksheets', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
notebook: jsonWithWorksheet, notebook: jsonWithWorksheet,
......
...@@ -45,7 +45,7 @@ describe('diff_discussion_header component', () => { ...@@ -45,7 +45,7 @@ describe('diff_discussion_header component', () => {
const truncatedCommitId = commitId.substr(0, 8); const truncatedCommitId = commitId.substr(0, 8);
let commitElement; let commitElement;
beforeEach(done => { beforeEach((done) => {
store.state.diffs = { store.state.diffs = {
projectPath: 'something', projectPath: 'something',
}; };
...@@ -72,7 +72,7 @@ describe('diff_discussion_header component', () => { ...@@ -72,7 +72,7 @@ describe('diff_discussion_header component', () => {
}); });
describe('for diff threads without a commit id', () => { describe('for diff threads without a commit id', () => {
it('should show started a thread on the diff text', done => { it('should show started a thread on the diff text', (done) => {
Object.assign(wrapper.vm.discussion, { Object.assign(wrapper.vm.discussion, {
for_commit: false, for_commit: false,
commit_id: null, commit_id: null,
...@@ -85,7 +85,7 @@ describe('diff_discussion_header component', () => { ...@@ -85,7 +85,7 @@ describe('diff_discussion_header component', () => {
}); });
}); });
it('should show thread on older version text', done => { it('should show thread on older version text', (done) => {
Object.assign(wrapper.vm.discussion, { Object.assign(wrapper.vm.discussion, {
for_commit: false, for_commit: false,
commit_id: null, commit_id: null,
...@@ -109,7 +109,7 @@ describe('diff_discussion_header component', () => { ...@@ -109,7 +109,7 @@ describe('diff_discussion_header component', () => {
}); });
describe('for diff thread with a commit id', () => { describe('for diff thread with a commit id', () => {
it('should display started thread on commit header', done => { it('should display started thread on commit header', (done) => {
wrapper.vm.discussion.for_commit = false; wrapper.vm.discussion.for_commit = false;
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
...@@ -121,7 +121,7 @@ describe('diff_discussion_header component', () => { ...@@ -121,7 +121,7 @@ describe('diff_discussion_header component', () => {
}); });
}); });
it('should display outdated change on commit header', done => { it('should display outdated change on commit header', (done) => {
wrapper.vm.discussion.for_commit = false; wrapper.vm.discussion.for_commit = false;
wrapper.vm.discussion.active = false; wrapper.vm.discussion.active = false;
......
...@@ -95,7 +95,7 @@ describe('DiscussionCounter component', () => { ...@@ -95,7 +95,7 @@ describe('DiscussionCounter component', () => {
describe('toggle all threads button', () => { describe('toggle all threads button', () => {
let toggleAllButton; let toggleAllButton;
const updateStoreWithExpanded = expanded => { const updateStoreWithExpanded = (expanded) => {
const discussion = { ...discussionMock, expanded }; const discussion = { ...discussionMock, expanded };
store.commit(types.SET_INITIAL_DISCUSSIONS, [discussion]); store.commit(types.SET_INITIAL_DISCUSSIONS, [discussion]);
store.dispatch('updateResolvableDiscussionsCounts'); store.dispatch('updateResolvableDiscussionsCounts');
......
...@@ -122,12 +122,12 @@ describe('DiscussionNotes', () => { ...@@ -122,12 +122,12 @@ describe('DiscussionNotes', () => {
describe('events', () => { describe('events', () => {
describe('with groupped notes and replies expanded', () => { describe('with groupped notes and replies expanded', () => {
const findNoteAtIndex = index => { const findNoteAtIndex = (index) => {
const noteComponents = [NoteableNote, SystemNote, PlaceholderNote, PlaceholderSystemNote]; const noteComponents = [NoteableNote, SystemNote, PlaceholderNote, PlaceholderSystemNote];
const allowedNames = noteComponents.map(c => c.name); const allowedNames = noteComponents.map((c) => c.name);
return wrapper return wrapper
.findAll('.notes *') .findAll('.notes *')
.filter(w => allowedNames.includes(w.name())) .filter((w) => allowedNames.includes(w.name()))
.at(index); .at(index);
}; };
......
...@@ -7,7 +7,7 @@ const buttonTitle = 'Resolve discussion'; ...@@ -7,7 +7,7 @@ const buttonTitle = 'Resolve discussion';
describe('resolveDiscussionButton', () => { describe('resolveDiscussionButton', () => {
let wrapper; let wrapper;
const factory = options => { const factory = (options) => {
wrapper = shallowMount(resolveDiscussionButton, { wrapper = shallowMount(resolveDiscussionButton, {
...options, ...options,
}); });
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
describe('Multiline comment utilities', () => { describe('Multiline comment utilities', () => {
describe('get start & end line numbers', () => { describe('get start & end line numbers', () => {
const lineRanges = ['old', 'new', null].map(type => ({ const lineRanges = ['old', 'new', null].map((type) => ({
start: { new_line: 1, old_line: 1, type }, start: { new_line: 1, old_line: 1, type },
end: { new_line: 2, old_line: 2, type }, end: { new_line: 2, old_line: 2, type },
})); }));
...@@ -35,7 +35,7 @@ describe('Multiline comment utilities', () => { ...@@ -35,7 +35,7 @@ describe('Multiline comment utilities', () => {
}); });
}); });
const inlineDiffLines = [{ line_code: '1' }, { line_code: '2' }, { line_code: '3' }]; const inlineDiffLines = [{ line_code: '1' }, { line_code: '2' }, { line_code: '3' }];
const parallelDiffLines = inlineDiffLines.map(line => ({ const parallelDiffLines = inlineDiffLines.map((line) => ({
left: { ...line }, left: { ...line },
right: { ...line }, right: { ...line },
})); }));
......
...@@ -101,7 +101,7 @@ describe('noteActions', () => { ...@@ -101,7 +101,7 @@ describe('noteActions', () => {
expect(wrapper.find('.js-btn-copy-note-link').exists()).toBe(true); expect(wrapper.find('.js-btn-copy-note-link').exists()).toBe(true);
}); });
it('should not show copy link action when `noteUrl` prop is empty', done => { it('should not show copy link action when `noteUrl` prop is empty', (done) => {
wrapper.setProps({ wrapper.setProps({
...props, ...props,
author: { author: {
...@@ -127,7 +127,7 @@ describe('noteActions', () => { ...@@ -127,7 +127,7 @@ describe('noteActions', () => {
expect(wrapper.find('.js-note-delete').exists()).toBe(true); expect(wrapper.find('.js-note-delete').exists()).toBe(true);
}); });
it('closes tooltip when dropdown opens', done => { it('closes tooltip when dropdown opens', (done) => {
wrapper.find('.more-actions-toggle').trigger('click'); wrapper.find('.more-actions-toggle').trigger('click');
const rootWrapper = createWrapper(wrapper.vm.$root); const rootWrapper = createWrapper(wrapper.vm.$root);
......
...@@ -7,7 +7,7 @@ describe('Issue note attachment', () => { ...@@ -7,7 +7,7 @@ describe('Issue note attachment', () => {
const findImage = () => wrapper.find({ ref: 'attachmentImage' }); const findImage = () => wrapper.find({ ref: 'attachmentImage' });
const findUrl = () => wrapper.find({ ref: 'attachmentUrl' }); const findUrl = () => wrapper.find({ ref: 'attachmentUrl' });
const createComponent = attachment => { const createComponent = (attachment) => {
wrapper = shallowMount(NoteAttachment, { wrapper = shallowMount(NoteAttachment, {
propsData: { propsData: {
attachment, attachment,
......
...@@ -106,7 +106,7 @@ describe('note_awards_list component', () => { ...@@ -106,7 +106,7 @@ describe('note_awards_list component', () => {
awardsMock = [...new Array(1)].map(createAwardEmoji); awardsMock = [...new Array(1)].map(createAwardEmoji);
mountComponent(); mountComponent();
awardsMock.forEach(award => { awardsMock.forEach((award) => {
expect(findTooltip()).toContain(award.user.name); expect(findTooltip()).toContain(award.user.name);
}); });
}); });
...@@ -115,7 +115,7 @@ describe('note_awards_list component', () => { ...@@ -115,7 +115,7 @@ describe('note_awards_list component', () => {
awardsMock = [...new Array(2)].map(createAwardEmoji); awardsMock = [...new Array(2)].map(createAwardEmoji);
mountComponent(); mountComponent();
awardsMock.forEach(award => { awardsMock.forEach((award) => {
expect(findTooltip()).toContain(award.user.name); expect(findTooltip()).toContain(award.user.name);
}); });
}); });
...@@ -125,7 +125,7 @@ describe('note_awards_list component', () => { ...@@ -125,7 +125,7 @@ describe('note_awards_list component', () => {
mountComponent(); mountComponent();
// Testing only the first 10 awards since 11 onward will not be displayed. // Testing only the first 10 awards since 11 onward will not be displayed.
awardsMock.slice(0, 10).forEach(award => { awardsMock.slice(0, 10).forEach((award) => {
expect(findTooltip()).toContain(award.user.name); expect(findTooltip()).toContain(award.user.name);
}); });
}); });
......
...@@ -38,7 +38,7 @@ describe('issue_note_body component', () => { ...@@ -38,7 +38,7 @@ describe('issue_note_body component', () => {
}); });
describe('isEditing', () => { describe('isEditing', () => {
beforeEach(done => { beforeEach((done) => {
vm.isEditing = true; vm.isEditing = true;
Vue.nextTick(done); Vue.nextTick(done);
}); });
......
...@@ -28,7 +28,7 @@ describe('issue_note_form component', () => { ...@@ -28,7 +28,7 @@ describe('issue_note_form component', () => {
}; };
beforeEach(() => { beforeEach(() => {
getDraft.mockImplementation(key => { getDraft.mockImplementation((key) => {
if (key === dummyAutosaveKey) { if (key === dummyAutosaveKey) {
return dummyDraft; return dummyDraft;
} }
...@@ -294,7 +294,7 @@ describe('issue_note_form component', () => { ...@@ -294,7 +294,7 @@ describe('issue_note_form component', () => {
discussion: { discussion: {
...discussionMock, ...discussionMock,
notes: [ notes: [
...discussionMock.notes.map(n => ({ ...discussionMock.notes.map((n) => ({
...n, ...n,
resolvable: true, resolvable: true,
current_user: { ...n.current_user, can_resolve_discussion: false }, current_user: { ...n.current_user, can_resolve_discussion: false },
......
...@@ -41,7 +41,7 @@ describe('NoteHeader component', () => { ...@@ -41,7 +41,7 @@ describe('NoteHeader component', () => {
}, },
}; };
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(NoteHeader, { wrapper = shallowMount(NoteHeader, {
localVue, localVue,
store: new Vuex.Store({ store: new Vuex.Store({
...@@ -252,7 +252,7 @@ describe('NoteHeader component', () => { ...@@ -252,7 +252,7 @@ describe('NoteHeader component', () => {
}); });
describe('when author username link is hovered', () => { describe('when author username link is hovered', () => {
it('toggles hover specific CSS classes on author name link', done => { it('toggles hover specific CSS classes on author name link', (done) => {
createComponent({ author }); createComponent({ author });
const authorUsernameLink = wrapper.find({ ref: 'authorUsernameLink' }); const authorUsernameLink = wrapper.find({ ref: 'authorUsernameLink' });
......
...@@ -132,7 +132,7 @@ describe('noteable_discussion component', () => { ...@@ -132,7 +132,7 @@ describe('noteable_discussion component', () => {
...getJSONFixture(discussionWithTwoUnresolvedNotes)[0], ...getJSONFixture(discussionWithTwoUnresolvedNotes)[0],
expanded: true, expanded: true,
}; };
discussion.notes = discussion.notes.map(note => ({ discussion.notes = discussion.notes.map((note) => ({
...note, ...note,
resolved: false, resolved: false,
current_user: { current_user: {
......
...@@ -208,7 +208,7 @@ describe('issue_note', () => { ...@@ -208,7 +208,7 @@ describe('issue_note', () => {
expect(noteBodyProps.helpPagePath).toBe(''); expect(noteBodyProps.helpPagePath).toBe('');
}); });
it('prevents note preview xss', done => { it('prevents note preview xss', (done) => {
const imgSrc = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; const imgSrc = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
const noteBody = `<img src="${imgSrc}" onload="alert(1)" />`; const noteBody = `<img src="${imgSrc}" onload="alert(1)" />`;
const alertSpy = jest.spyOn(window, 'alert'); const alertSpy = jest.spyOn(window, 'alert');
...@@ -230,7 +230,7 @@ describe('issue_note', () => { ...@@ -230,7 +230,7 @@ describe('issue_note', () => {
}); });
describe('cancel edit', () => { describe('cancel edit', () => {
it('restores content of updated note', done => { it('restores content of updated note', (done) => {
const updatedText = 'updated note text'; const updatedText = 'updated note text';
store.hotUpdate({ store.hotUpdate({
actions: { actions: {
......
...@@ -36,16 +36,16 @@ describe('note_app', () => { ...@@ -36,16 +36,16 @@ describe('note_app', () => {
const getComponentOrder = () => { const getComponentOrder = () => {
return wrapper return wrapper
.findAll('#notes-list,.js-comment-form') .findAll('#notes-list,.js-comment-form')
.wrappers.map(node => (node.is(CommentForm) ? TYPE_COMMENT_FORM : TYPE_NOTES_LIST)); .wrappers.map((node) => (node.is(CommentForm) ? TYPE_COMMENT_FORM : TYPE_NOTES_LIST));
}; };
/** /**
* waits for fetchNotes() to complete * waits for fetchNotes() to complete
*/ */
const waitForDiscussionsRequest = () => const waitForDiscussionsRequest = () =>
new Promise(resolve => { new Promise((resolve) => {
const { vm } = wrapper.find(NotesApp); const { vm } = wrapper.find(NotesApp);
const unwatch = vm.$watch('isFetching', isFetching => { const unwatch = vm.$watch('isFetching', (isFetching) => {
if (isFetching) { if (isFetching) {
return; return;
} }
......
...@@ -3,7 +3,7 @@ import mountComponent from 'helpers/vue_mount_component_helper'; ...@@ -3,7 +3,7 @@ import mountComponent from 'helpers/vue_mount_component_helper';
import toggleRepliesWidget from '~/notes/components/toggle_replies_widget.vue'; import toggleRepliesWidget from '~/notes/components/toggle_replies_widget.vue';
import { note } from '../mock_data'; import { note } from '../mock_data';
const deepCloneObject = obj => JSON.parse(JSON.stringify(obj)); const deepCloneObject = (obj) => JSON.parse(JSON.stringify(obj));
describe('toggle replies widget for notes', () => { describe('toggle replies widget for notes', () => {
let vm; let vm;
......
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