Commit 9a5c0155 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'leipert-prettier-arrow-parens-14' into 'master'

Format files with prettier arrowParens [14/15]

See merge request gitlab-org/gitlab!50543
parents 3a71d488 f2d28d7a
...@@ -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;
......
export const resetStore = store => { export const resetStore = (store) => {
store.replaceState({ store.replaceState({
notes: [], notes: [],
targetNoteHash: null, targetNoteHash: null,
......
...@@ -34,7 +34,7 @@ describe('Discussion navigation mixin', () => { ...@@ -34,7 +34,7 @@ describe('Discussion navigation mixin', () => {
setHTMLFixture( setHTMLFixture(
[...'abcde'] [...'abcde']
.map( .map(
id => (id) =>
`<ul class="notes" data-discussion-id="${id}"></ul> `<ul class="notes" data-discussion-id="${id}"></ul>
<div class="discussion" data-discussion-id="${id}"></div>`, <div class="discussion" data-discussion-id="${id}"></div>`,
) )
......
...@@ -127,7 +127,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -127,7 +127,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
jest.spyOn(notes, 'renderNote'); jest.spyOn(notes, 'renderNote');
$('.js-comment-button').on('click', e => { $('.js-comment-button').on('click', (e) => {
const $form = $(this); const $form = $(this);
e.preventDefault(); e.preventDefault();
notes.addNote($form, {}); notes.addNote($form, {});
...@@ -550,7 +550,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -550,7 +550,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
expect($notesContainer.find('.note.being-posted').length).toBeGreaterThan(0); expect($notesContainer.find('.note.being-posted').length).toBeGreaterThan(0);
}); });
it('should remove placeholder note when new comment is done posting', done => { it('should remove placeholder note when new comment is done posting', (done) => {
mockNotesPost(); mockNotesPost();
$('.js-comment-button').click(); $('.js-comment-button').click();
...@@ -562,7 +562,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -562,7 +562,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
describe('postComment', () => { describe('postComment', () => {
it('disables the submit button', done => { it('disables the submit button', (done) => {
const $submitButton = $form.find('.js-comment-submit-button'); const $submitButton = $form.find('.js-comment-submit-button');
expect($submitButton).not.toBeDisabled(); expect($submitButton).not.toBeDisabled();
...@@ -585,7 +585,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -585,7 +585,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
}); });
it('should show actual note element when new comment is done posting', done => { it('should show actual note element when new comment is done posting', (done) => {
mockNotesPost(); mockNotesPost();
$('.js-comment-button').click(); $('.js-comment-button').click();
...@@ -596,7 +596,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -596,7 +596,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
}); });
it('should reset Form when new comment is done posting', done => { it('should reset Form when new comment is done posting', (done) => {
mockNotesPost(); mockNotesPost();
$('.js-comment-button').click(); $('.js-comment-button').click();
...@@ -607,7 +607,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -607,7 +607,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
}); });
it('should show flash error message when new comment failed to be posted', done => { it('should show flash error message when new comment failed to be posted', (done) => {
mockNotesPostError(); mockNotesPostError();
jest.spyOn(notes, 'addFlash'); jest.spyOn(notes, 'addFlash');
...@@ -658,7 +658,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -658,7 +658,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
$form.find('textarea.js-note-text').val(sampleComment); $form.find('textarea.js-note-text').val(sampleComment);
}); });
it('should remove quick action placeholder when comment with quick actions is done posting', done => { it('should remove quick action placeholder when comment with quick actions is done posting', (done) => {
jest.spyOn(gl.awardsHandler, 'addAwardToEmojiBar'); jest.spyOn(gl.awardsHandler, 'addAwardToEmojiBar');
$('.js-comment-button').click(); $('.js-comment-button').click();
...@@ -693,7 +693,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -693,7 +693,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
$form.find('textarea.js-note-text').val(sampleComment); $form.find('textarea.js-note-text').val(sampleComment);
}); });
it('should show message placeholder including lines starting with slash', done => { it('should show message placeholder including lines starting with slash', (done) => {
$('.js-comment-button').click(); $('.js-comment-button').click();
expect($notesContainer.find('.note.being-posted').length).toEqual(1); // Placeholder shown expect($notesContainer.find('.note.being-posted').length).toEqual(1); // Placeholder shown
...@@ -731,7 +731,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -731,7 +731,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
$form.find('textarea.js-note-text').html(sampleComment); $form.find('textarea.js-note-text').html(sampleComment);
}); });
it('should not render a script tag', done => { it('should not render a script tag', (done) => {
$('.js-comment-button').click(); $('.js-comment-button').click();
setImmediate(() => { setImmediate(() => {
......
This diff is collapsed.
...@@ -72,7 +72,7 @@ describe('Getters Notes Store', () => { ...@@ -72,7 +72,7 @@ describe('Getters Notes Store', () => {
state.isTimelineEnabled = true; state.isTimelineEnabled = true;
expect(getters.discussions(state).length).toEqual(discussionMock.notes.length); expect(getters.discussions(state).length).toEqual(discussionMock.notes.length);
getters.discussions(state).forEach(discussion => { getters.discussions(state).forEach((discussion) => {
expect(discussion.individual_note).toBe(true); expect(discussion.individual_note).toBe(true);
expect(discussion.id).toBe(discussion.notes[0].id); expect(discussion.id).toBe(discussion.notes[0].id);
expect(discussion.created_at).toBe(discussion.notes[0].created_at); expect(discussion.created_at).toBe(discussion.notes[0].created_at);
......
...@@ -357,7 +357,7 @@ describe('Notes Store mutations', () => { ...@@ -357,7 +357,7 @@ describe('Notes Store mutations', () => {
mutations.SET_EXPAND_DISCUSSIONS(state, { discussionIds, expanded: true }); mutations.SET_EXPAND_DISCUSSIONS(state, { discussionIds, expanded: true });
state.discussions.forEach(discussion => { state.discussions.forEach((discussion) => {
expect(discussion.expanded).toEqual(true); expect(discussion.expanded).toEqual(true);
}); });
}); });
...@@ -371,7 +371,7 @@ describe('Notes Store mutations', () => { ...@@ -371,7 +371,7 @@ describe('Notes Store mutations', () => {
mutations.SET_EXPAND_DISCUSSIONS(state, { discussionIds, expanded: false }); mutations.SET_EXPAND_DISCUSSIONS(state, { discussionIds, expanded: false });
state.discussions.forEach(discussion => { state.discussions.forEach((discussion) => {
expect(discussion.expanded).toEqual(false); expect(discussion.expanded).toEqual(false);
}); });
}); });
...@@ -698,7 +698,7 @@ describe('Notes Store mutations', () => { ...@@ -698,7 +698,7 @@ describe('Notes Store mutations', () => {
}); });
describe('SET_APPLYING_BATCH_STATE', () => { describe('SET_APPLYING_BATCH_STATE', () => {
const buildDiscussions = suggestionsInfo => { const buildDiscussions = (suggestionsInfo) => {
const suggestions = suggestionsInfo.map(({ suggestionId }) => ({ id: suggestionId })); const suggestions = suggestionsInfo.map(({ suggestionId }) => ({ id: suggestionId }));
const notes = suggestionsInfo.map(({ noteId }, index) => ({ const notes = suggestionsInfo.map(({ noteId }, index) => ({
...@@ -738,7 +738,7 @@ describe('Notes Store mutations', () => { ...@@ -738,7 +738,7 @@ describe('Notes Store mutations', () => {
const expectedSuggestions = [updatedSuggestion, suggestions[1]]; const expectedSuggestions = [updatedSuggestion, suggestions[1]];
const actualSuggestions = state.discussions const actualSuggestions = state.discussions
.map(discussion => discussion.notes.map(n => n.suggestions)) .map((discussion) => discussion.notes.map((n) => n.suggestions))
.flat(2); .flat(2);
expect(actualSuggestions).toEqual(expectedSuggestions); expect(actualSuggestions).toEqual(expectedSuggestions);
......
...@@ -2,7 +2,7 @@ import $ from 'jquery'; ...@@ -2,7 +2,7 @@ import $ from 'jquery';
import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me'; import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me';
describe('OAuthRememberMe', () => { describe('OAuthRememberMe', () => {
const findFormAction = selector => { const findFormAction = (selector) => {
return $(`#oauth-container .oauth-login${selector}`).parent('form').attr('action'); return $(`#oauth-container .oauth-login${selector}`).parent('form').attr('action');
}; };
......
...@@ -11,7 +11,7 @@ describe('Package Additional Metadata', () => { ...@@ -11,7 +11,7 @@ describe('Package Additional Metadata', () => {
packageEntity: { ...mavenPackage }, packageEntity: { ...mavenPackage },
}; };
const mountComponent = props => { const mountComponent = (props) => {
wrapper = shallowMount(component, { wrapper = shallowMount(component, {
propsData: { ...defaultProps, ...props }, propsData: { ...defaultProps, ...props },
stubs: { stubs: {
...@@ -33,7 +33,7 @@ describe('Package Additional Metadata', () => { ...@@ -33,7 +33,7 @@ describe('Package Additional Metadata', () => {
const findConanRecipe = () => wrapper.find('[data-testid="conan-recipe"]'); const findConanRecipe = () => wrapper.find('[data-testid="conan-recipe"]');
const findMavenApp = () => wrapper.find('[data-testid="maven-app"]'); const findMavenApp = () => wrapper.find('[data-testid="maven-app"]');
const findMavenGroup = () => wrapper.find('[data-testid="maven-group"]'); const findMavenGroup = () => wrapper.find('[data-testid="maven-group"]');
const findElementLink = container => container.find(GlLink); const findElementLink = (container) => container.find(GlLink);
it('has the correct title', () => { it('has the correct title', () => {
mountComponent(); mountComponent();
......
...@@ -15,10 +15,10 @@ describe('Package History', () => { ...@@ -15,10 +15,10 @@ describe('Package History', () => {
packageEntity: { ...mavenPackage }, packageEntity: { ...mavenPackage },
}; };
const createPipelines = amount => const createPipelines = (amount) =>
[...Array(amount)].map((x, index) => ({ ...mockPipelineInfo, id: index + 1 })); [...Array(amount)].map((x, index) => ({ ...mockPipelineInfo, id: index + 1 }));
const mountComponent = props => { const mountComponent = (props) => {
wrapper = shallowMount(component, { wrapper = shallowMount(component, {
propsData: { ...defaultProps, ...props }, propsData: { ...defaultProps, ...props },
stubs: { stubs: {
...@@ -35,9 +35,9 @@ describe('Package History', () => { ...@@ -35,9 +35,9 @@ describe('Package History', () => {
wrapper = null; wrapper = null;
}); });
const findHistoryElement = testId => wrapper.find(`[data-testid="${testId}"]`); const findHistoryElement = (testId) => wrapper.find(`[data-testid="${testId}"]`);
const findElementLink = container => container.find(GlLink); const findElementLink = (container) => container.find(GlLink);
const findElementTimeAgo = container => container.find(TimeAgoTooltip); const findElementTimeAgo = (container) => container.find(TimeAgoTooltip);
const findTitle = () => wrapper.find('[data-testid="title"]'); const findTitle = () => wrapper.find('[data-testid="title"]');
const findTimeline = () => wrapper.find('[data-testid="timeline"]'); const findTimeline = () => wrapper.find('[data-testid="timeline"]');
......
...@@ -12,7 +12,7 @@ jest.mock('~/api.js'); ...@@ -12,7 +12,7 @@ jest.mock('~/api.js');
describe('Actions Package details store', () => { describe('Actions Package details store', () => {
describe('fetchPackageVersions', () => { describe('fetchPackageVersions', () => {
it('should fetch the package versions', done => { it('should fetch the package versions', (done) => {
Api.projectPackage = jest.fn().mockResolvedValue({ data: packageEntity }); Api.projectPackage = jest.fn().mockResolvedValue({ data: packageEntity });
testAction( testAction(
...@@ -35,7 +35,7 @@ describe('Actions Package details store', () => { ...@@ -35,7 +35,7 @@ describe('Actions Package details store', () => {
); );
}); });
it("does not set the versions if they don't exist", done => { it("does not set the versions if they don't exist", (done) => {
Api.projectPackage = jest.fn().mockResolvedValue({ data: { packageEntity, versions: null } }); Api.projectPackage = jest.fn().mockResolvedValue({ data: { packageEntity, versions: null } });
testAction( testAction(
...@@ -57,7 +57,7 @@ describe('Actions Package details store', () => { ...@@ -57,7 +57,7 @@ describe('Actions Package details store', () => {
); );
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
Api.projectPackage = jest.fn().mockRejectedValue(); Api.projectPackage = jest.fn().mockRejectedValue();
testAction( testAction(
...@@ -82,7 +82,7 @@ describe('Actions Package details store', () => { ...@@ -82,7 +82,7 @@ describe('Actions Package details store', () => {
}); });
describe('deletePackage', () => { describe('deletePackage', () => {
it('should call Api.deleteProjectPackage', done => { it('should call Api.deleteProjectPackage', (done) => {
Api.deleteProjectPackage = jest.fn().mockResolvedValue(); Api.deleteProjectPackage = jest.fn().mockResolvedValue();
testAction(deletePackage, undefined, { packageEntity }, [], [], () => { testAction(deletePackage, undefined, { packageEntity }, [], [], () => {
expect(Api.deleteProjectPackage).toHaveBeenCalledWith( expect(Api.deleteProjectPackage).toHaveBeenCalledWith(
...@@ -92,7 +92,7 @@ describe('Actions Package details store', () => { ...@@ -92,7 +92,7 @@ describe('Actions Package details store', () => {
done(); done();
}); });
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
Api.deleteProjectPackage = jest.fn().mockRejectedValue(); Api.deleteProjectPackage = jest.fn().mockRejectedValue();
testAction(deletePackage, undefined, { packageEntity }, [], [], () => { testAction(deletePackage, undefined, { packageEntity }, [], [], () => {
......
...@@ -16,7 +16,7 @@ describe('packages_sort', () => { ...@@ -16,7 +16,7 @@ describe('packages_sort', () => {
const findPackageListSorting = () => wrapper.find(GlSorting); const findPackageListSorting = () => wrapper.find(GlSorting);
const findSortingItems = () => wrapper.findAll(GlSortingItem); const findSortingItems = () => wrapper.findAll(GlSortingItem);
const createStore = isGroupPage => { const createStore = (isGroupPage) => {
const state = { const state = {
config: { config: {
isGroupPage, isGroupPage,
......
...@@ -30,7 +30,7 @@ describe('Actions Package list store', () => { ...@@ -30,7 +30,7 @@ describe('Actions Package list store', () => {
sort: 'asc', sort: 'asc',
orderBy: 'version', orderBy: 'version',
}; };
it('should fetch the project packages list when isGroupPage is false', done => { it('should fetch the project packages list when isGroupPage is false', (done) => {
testAction( testAction(
actions.requestPackagesList, actions.requestPackagesList,
undefined, undefined,
...@@ -50,7 +50,7 @@ describe('Actions Package list store', () => { ...@@ -50,7 +50,7 @@ describe('Actions Package list store', () => {
); );
}); });
it('should fetch the group packages list when isGroupPage is true', done => { it('should fetch the group packages list when isGroupPage is true', (done) => {
testAction( testAction(
actions.requestPackagesList, actions.requestPackagesList,
undefined, undefined,
...@@ -70,7 +70,7 @@ describe('Actions Package list store', () => { ...@@ -70,7 +70,7 @@ describe('Actions Package list store', () => {
); );
}); });
it('should fetch packages of a certain type when selectedType is present', done => { it('should fetch packages of a certain type when selectedType is present', (done) => {
const packageType = 'maven'; const packageType = 'maven';
testAction( testAction(
...@@ -102,7 +102,7 @@ describe('Actions Package list store', () => { ...@@ -102,7 +102,7 @@ describe('Actions Package list store', () => {
); );
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
Api.projectPackages = jest.fn().mockRejectedValue(); Api.projectPackages = jest.fn().mockRejectedValue();
testAction( testAction(
actions.requestPackagesList, actions.requestPackagesList,
...@@ -122,7 +122,7 @@ describe('Actions Package list store', () => { ...@@ -122,7 +122,7 @@ describe('Actions Package list store', () => {
}); });
describe('receivePackagesListSuccess', () => { describe('receivePackagesListSuccess', () => {
it('should set received packages', done => { it('should set received packages', (done) => {
const data = 'foo'; const data = 'foo';
testAction( testAction(
...@@ -140,7 +140,7 @@ describe('Actions Package list store', () => { ...@@ -140,7 +140,7 @@ describe('Actions Package list store', () => {
}); });
describe('setInitialState', () => { describe('setInitialState', () => {
it('should commit setInitialState', done => { it('should commit setInitialState', (done) => {
testAction( testAction(
actions.setInitialState, actions.setInitialState,
'1', '1',
...@@ -153,7 +153,7 @@ describe('Actions Package list store', () => { ...@@ -153,7 +153,7 @@ describe('Actions Package list store', () => {
}); });
describe('setLoading', () => { describe('setLoading', () => {
it('should commit set main loading', done => { it('should commit set main loading', (done) => {
testAction( testAction(
actions.setLoading, actions.setLoading,
true, true,
...@@ -171,7 +171,7 @@ describe('Actions Package list store', () => { ...@@ -171,7 +171,7 @@ describe('Actions Package list store', () => {
delete_api_path: 'foo', delete_api_path: 'foo',
}, },
}; };
it('should perform a delete operation on _links.delete_api_path', done => { it('should perform a delete operation on _links.delete_api_path', (done) => {
mock.onDelete(payload._links.delete_api_path).replyOnce(200); mock.onDelete(payload._links.delete_api_path).replyOnce(200);
Api.projectPackages = jest.fn().mockResolvedValue({ data: 'foo' }); Api.projectPackages = jest.fn().mockResolvedValue({ data: 'foo' });
...@@ -188,7 +188,7 @@ describe('Actions Package list store', () => { ...@@ -188,7 +188,7 @@ describe('Actions Package list store', () => {
); );
}); });
it('should stop the loading and call create flash on api error', done => { it('should stop the loading and call create flash on api error', (done) => {
mock.onDelete(payload._links.delete_api_path).replyOnce(400); mock.onDelete(payload._links.delete_api_path).replyOnce(400);
testAction( testAction(
actions.requestDeletePackage, actions.requestDeletePackage,
...@@ -211,7 +211,7 @@ describe('Actions Package list store', () => { ...@@ -211,7 +211,7 @@ describe('Actions Package list store', () => {
${'_links'} | ${{}} ${'_links'} | ${{}}
${'delete_api_path'} | ${{ _links: {} }} ${'delete_api_path'} | ${{ _links: {} }}
`('should reject and createFlash when $property is missing', ({ actionPayload }, done) => { `('should reject and createFlash when $property is missing', ({ actionPayload }, done) => {
testAction(actions.requestDeletePackage, actionPayload, null, [], []).catch(e => { testAction(actions.requestDeletePackage, actionPayload, null, [], []).catch((e) => {
expect(e).toEqual(new Error(MISSING_DELETE_PATH_ERROR)); expect(e).toEqual(new Error(MISSING_DELETE_PATH_ERROR));
expect(createFlash).toHaveBeenCalledWith(DELETE_PACKAGE_ERROR_MESSAGE); expect(createFlash).toHaveBeenCalledWith(DELETE_PACKAGE_ERROR_MESSAGE);
done(); done();
...@@ -220,7 +220,7 @@ describe('Actions Package list store', () => { ...@@ -220,7 +220,7 @@ describe('Actions Package list store', () => {
}); });
describe('setSorting', () => { describe('setSorting', () => {
it('should commit SET_SORTING', done => { it('should commit SET_SORTING', (done) => {
testAction( testAction(
actions.setSorting, actions.setSorting,
'foo', 'foo',
...@@ -233,7 +233,7 @@ describe('Actions Package list store', () => { ...@@ -233,7 +233,7 @@ describe('Actions Package list store', () => {
}); });
describe('setFilter', () => { describe('setFilter', () => {
it('should commit SET_FILTER', done => { it('should commit SET_FILTER', (done) => {
testAction( testAction(
actions.setFilter, actions.setFilter,
'foo', 'foo',
......
...@@ -21,8 +21,8 @@ describe('PackagePath', () => { ...@@ -21,8 +21,8 @@ describe('PackagePath', () => {
const ELLIPSIS_CHEVRON = 'ellipsis-chevron'; const ELLIPSIS_CHEVRON = 'ellipsis-chevron';
const LEAF_LINK = 'leaf-link'; const LEAF_LINK = 'leaf-link';
const findItem = name => wrapper.find(`[data-testid="${name}"]`); const findItem = (name) => wrapper.find(`[data-testid="${name}"]`);
const findTooltip = w => getBinding(w.element, 'gl-tooltip'); const findTooltip = (w) => getBinding(w.element, 'gl-tooltip');
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -64,13 +64,13 @@ describe('PackagePath', () => { ...@@ -64,13 +64,13 @@ describe('PackagePath', () => {
} }
if (shouldExist.length) { if (shouldExist.length) {
it.each(shouldExist)(`should have %s`, element => { it.each(shouldExist)(`should have %s`, (element) => {
expect(findItem(element).exists()).toBe(true); expect(findItem(element).exists()).toBe(true);
}); });
} }
if (shouldNotExist.length) { if (shouldNotExist.length) {
it.each(shouldNotExist)(`should not have %s`, element => { it.each(shouldNotExist)(`should not have %s`, (element) => {
expect(findItem(element).exists()).toBe(false); expect(findItem(element).exists()).toBe(false);
}); });
} }
......
...@@ -13,7 +13,7 @@ describe('Packages shared utils', () => { ...@@ -13,7 +13,7 @@ describe('Packages shared utils', () => {
expect(packageTypeToTrackCategory()).toMatchInlineSnapshot(`"UI::undefined"`); expect(packageTypeToTrackCategory()).toMatchInlineSnapshot(`"UI::undefined"`);
}); });
it.each(Object.keys(PackageType))('returns a correct category string for %s', packageKey => { it.each(Object.keys(PackageType))('returns a correct category string for %s', (packageKey) => {
const packageName = PackageType[packageKey]; const packageName = PackageType[packageKey];
expect(packageTypeToTrackCategory(packageName)).toBe( expect(packageTypeToTrackCategory(packageName)).toBe(
`UI::${TrackingCategories[packageName]}`, `UI::${TrackingCategories[packageName]}`,
......
...@@ -89,7 +89,7 @@ describe('pager', () => { ...@@ -89,7 +89,7 @@ describe('pager', () => {
Pager.init(); Pager.init();
}); });
it('shows loader while loading next page', done => { it('shows loader while loading next page', (done) => {
mockSuccess(); mockSuccess();
jest.spyOn(Pager.loading, 'show').mockImplementation(() => {}); jest.spyOn(Pager.loading, 'show').mockImplementation(() => {});
...@@ -102,7 +102,7 @@ describe('pager', () => { ...@@ -102,7 +102,7 @@ describe('pager', () => {
}); });
}); });
it('hides loader on success', done => { it('hides loader on success', (done) => {
mockSuccess(); mockSuccess();
jest.spyOn(Pager.loading, 'hide').mockImplementation(() => {}); jest.spyOn(Pager.loading, 'hide').mockImplementation(() => {});
...@@ -115,7 +115,7 @@ describe('pager', () => { ...@@ -115,7 +115,7 @@ describe('pager', () => {
}); });
}); });
it('hides loader on error', done => { it('hides loader on error', (done) => {
mockError(); mockError();
jest.spyOn(Pager.loading, 'hide').mockImplementation(() => {}); jest.spyOn(Pager.loading, 'hide').mockImplementation(() => {});
...@@ -128,7 +128,7 @@ describe('pager', () => { ...@@ -128,7 +128,7 @@ describe('pager', () => {
}); });
}); });
it('sends request to url with offset and limit params', done => { it('sends request to url with offset and limit params', (done) => {
Pager.offset = 100; Pager.offset = 100;
Pager.limit = 20; Pager.limit = 20;
Pager.getOld(); Pager.getOld();
...@@ -149,7 +149,7 @@ describe('pager', () => { ...@@ -149,7 +149,7 @@ describe('pager', () => {
}); });
}); });
it('disables if return count is less than limit', done => { it('disables if return count is less than limit', (done) => {
Pager.offset = 0; Pager.offset = 0;
Pager.limit = 20; Pager.limit = 20;
......
...@@ -8,10 +8,10 @@ describe('Abuse Reports', () => { ...@@ -8,10 +8,10 @@ describe('Abuse Reports', () => {
let $messages; let $messages;
const assertMaxLength = $message => { const assertMaxLength = ($message) => {
expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH); expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH);
}; };
const findMessage = searchText => const findMessage = (searchText) =>
$messages.filter((index, element) => element.innerText.indexOf(searchText) > -1).first(); $messages.filter((index, element) => element.innerText.indexOf(searchText) > -1).first();
preloadFixtures(FIXTURE); preloadFixtures(FIXTURE);
......
...@@ -24,7 +24,7 @@ describe('AccountAndLimits', () => { ...@@ -24,7 +24,7 @@ describe('AccountAndLimits', () => {
expect($userInternalRegex.readOnly).toBeTruthy(); expect($userInternalRegex.readOnly).toBeTruthy();
}); });
it('is checked', done => { it('is checked', (done) => {
if (!$userDefaultExternal.prop('checked')) $userDefaultExternal.click(); if (!$userDefaultExternal.prop('checked')) $userDefaultExternal.click();
expect($userDefaultExternal.prop('checked')).toBeTruthy(); expect($userDefaultExternal.prop('checked')).toBeTruthy();
......
...@@ -26,9 +26,9 @@ describe('stop_jobs_modal.vue', () => { ...@@ -26,9 +26,9 @@ describe('stop_jobs_modal.vue', () => {
}); });
describe('onSubmit', () => { describe('onSubmit', () => {
it('stops jobs and redirects to overview page', done => { it('stops jobs and redirects to overview page', (done) => {
const responseURL = `${TEST_HOST}/stop_jobs_modal.vue/jobs`; const responseURL = `${TEST_HOST}/stop_jobs_modal.vue/jobs`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(props.url); expect(url).toBe(props.url);
return Promise.resolve({ return Promise.resolve({
request: { request: {
...@@ -45,16 +45,16 @@ describe('stop_jobs_modal.vue', () => { ...@@ -45,16 +45,16 @@ describe('stop_jobs_modal.vue', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('displays error if stopping jobs failed', done => { it('displays error if stopping jobs failed', (done) => {
const dummyError = new Error('stopping jobs failed'); const dummyError = new Error('stopping jobs failed');
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(props.url); expect(url).toBe(props.url);
return Promise.reject(dummyError); return Promise.reject(dummyError);
}); });
vm.onSubmit() vm.onSubmit()
.then(done.fail) .then(done.fail)
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(redirectTo).not.toHaveBeenCalled(); expect(redirectTo).not.toHaveBeenCalled();
}) })
......
...@@ -11,10 +11,10 @@ describe('User Operation confirmation modal', () => { ...@@ -11,10 +11,10 @@ describe('User Operation confirmation modal', () => {
let wrapper; let wrapper;
let formSubmitSpy; let formSubmitSpy;
const findButton = variant => const findButton = (variant) =>
wrapper wrapper
.findAll(GlButton) .findAll(GlButton)
.filter(w => w.attributes('variant') === variant) .filter((w) => w.attributes('variant') === variant)
.at(0); .at(0);
const findForm = () => wrapper.find('form'); const findForm = () => wrapper.find('form');
const findUsernameInput = () => wrapper.find(GlFormInput); const findUsernameInput = () => wrapper.find(GlFormInput);
...@@ -25,7 +25,7 @@ describe('User Operation confirmation modal', () => { ...@@ -25,7 +25,7 @@ describe('User Operation confirmation modal', () => {
const getMethodParam = () => new FormData(findForm().element).get('_method'); const getMethodParam = () => new FormData(findForm().element).get('_method');
const getFormAction = () => findForm().attributes('action'); const getFormAction = () => findForm().attributes('action');
const setUsername = username => { const setUsername = (username) => {
findUsernameInput().vm.$emit('input', username); findUsernameInput().vm.$emit('input', username);
}; };
......
...@@ -20,7 +20,7 @@ describe('UserInternalRegexHandler', () => { ...@@ -20,7 +20,7 @@ describe('UserInternalRegexHandler', () => {
}); });
describe('Behaviour of userExternal checkbox when', () => { describe('Behaviour of userExternal checkbox when', () => {
it('matches email as internal', done => { it('matches email as internal', (done) => {
expect($warningMessage.hasClass('hidden')).toBeTruthy(); expect($warningMessage.hasClass('hidden')).toBeTruthy();
$userEmail.val('test@').trigger('input'); $userEmail.val('test@').trigger('input');
...@@ -30,7 +30,7 @@ describe('UserInternalRegexHandler', () => { ...@@ -30,7 +30,7 @@ describe('UserInternalRegexHandler', () => {
done(); done();
}); });
it('matches email as external', done => { it('matches email as external', (done) => {
expect($warningMessage.hasClass('hidden')).toBeTruthy(); expect($warningMessage.hasClass('hidden')).toBeTruthy();
$userEmail.val('test.ext@').trigger('input'); $userEmail.val('test.ext@').trigger('input');
......
...@@ -31,10 +31,10 @@ describe('Todos', () => { ...@@ -31,10 +31,10 @@ describe('Todos', () => {
}); });
describe('goToTodoUrl', () => { describe('goToTodoUrl', () => {
it('opens the todo url', done => { it('opens the todo url', (done) => {
const todoLink = todoItem.dataset.url; const todoLink = todoItem.dataset.url;
visitUrl.mockImplementation(url => { visitUrl.mockImplementation((url) => {
expect(url).toEqual(todoLink); expect(url).toEqual(todoLink);
done(); done();
}); });
...@@ -61,7 +61,7 @@ describe('Todos', () => { ...@@ -61,7 +61,7 @@ describe('Todos', () => {
}); });
it('run native funcionality when avatar is clicked', () => { it('run native funcionality when avatar is clicked', () => {
$('.todos-list a').on('click', e => e.preventDefault()); $('.todos-list a').on('click', (e) => e.preventDefault());
$('.todos-list img').trigger(metakeyEvent); $('.todos-list img').trigger(metakeyEvent);
expect(visitUrl).not.toHaveBeenCalled(); expect(visitUrl).not.toHaveBeenCalled();
...@@ -72,7 +72,7 @@ describe('Todos', () => { ...@@ -72,7 +72,7 @@ describe('Todos', () => {
describe('on done todo click', () => { describe('on done todo click', () => {
let onToggleSpy; let onToggleSpy;
beforeEach(done => { beforeEach((done) => {
const el = document.querySelector('.js-done-todo'); const el = document.querySelector('.js-done-todo');
const path = el.dataset.href; const path = el.dataset.href;
......
...@@ -15,7 +15,7 @@ describe('BitbucketServerStatusTable', () => { ...@@ -15,7 +15,7 @@ describe('BitbucketServerStatusTable', () => {
const findReconfigureButton = () => const findReconfigureButton = () =>
wrapper wrapper
.findAll(GlButton) .findAll(GlButton)
.filter(w => w.props().variant === 'info') .filter((w) => w.props().variant === 'info')
.at(0); .at(0);
afterEach(() => { afterEach(() => {
......
...@@ -50,9 +50,9 @@ describe('Promote label modal', () => { ...@@ -50,9 +50,9 @@ describe('Promote label modal', () => {
vm.$destroy(); vm.$destroy();
}); });
it('redirects when a label is promoted', done => { it('redirects when a label is promoted', (done) => {
const responseURL = `${TEST_HOST}/dummy/endpoint`; const responseURL = `${TEST_HOST}/dummy/endpoint`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(labelMockData.url); expect(url).toBe(labelMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'promoteLabelModal.requestStarted', 'promoteLabelModal.requestStarted',
...@@ -76,10 +76,10 @@ describe('Promote label modal', () => { ...@@ -76,10 +76,10 @@ describe('Promote label modal', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('displays an error if promoting a label failed', done => { it('displays an error if promoting a label failed', (done) => {
const dummyError = new Error('promoting label failed'); const dummyError = new Error('promoting label failed');
dummyError.response = { status: 500 }; dummyError.response = { status: 500 };
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(labelMockData.url); expect(url).toBe(labelMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'promoteLabelModal.requestStarted', 'promoteLabelModal.requestStarted',
...@@ -89,7 +89,7 @@ describe('Promote label modal', () => { ...@@ -89,7 +89,7 @@ describe('Promote label modal', () => {
}); });
vm.onSubmit() vm.onSubmit()
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(eventHub.$emit).toHaveBeenCalledWith('promoteLabelModal.requestFinished', { expect(eventHub.$emit).toHaveBeenCalledWith('promoteLabelModal.requestFinished', {
labelUrl: labelMockData.url, labelUrl: labelMockData.url,
......
...@@ -32,9 +32,9 @@ describe('delete_milestone_modal.vue', () => { ...@@ -32,9 +32,9 @@ describe('delete_milestone_modal.vue', () => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
}); });
it('deletes milestone and redirects to overview page', done => { it('deletes milestone and redirects to overview page', (done) => {
const responseURL = `${TEST_HOST}/delete_milestone_modal.vue/milestoneOverview`; const responseURL = `${TEST_HOST}/delete_milestone_modal.vue/milestoneOverview`;
jest.spyOn(axios, 'delete').mockImplementation(url => { jest.spyOn(axios, 'delete').mockImplementation((url) => {
expect(url).toBe(props.milestoneUrl); expect(url).toBe(props.milestoneUrl);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'deleteMilestoneModal.requestStarted', 'deleteMilestoneModal.requestStarted',
...@@ -60,10 +60,10 @@ describe('delete_milestone_modal.vue', () => { ...@@ -60,10 +60,10 @@ describe('delete_milestone_modal.vue', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('displays error if deleting milestone failed', done => { it('displays error if deleting milestone failed', (done) => {
const dummyError = new Error('deleting milestone failed'); const dummyError = new Error('deleting milestone failed');
dummyError.response = { status: 418 }; dummyError.response = { status: 418 };
jest.spyOn(axios, 'delete').mockImplementation(url => { jest.spyOn(axios, 'delete').mockImplementation((url) => {
expect(url).toBe(props.milestoneUrl); expect(url).toBe(props.milestoneUrl);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'deleteMilestoneModal.requestStarted', 'deleteMilestoneModal.requestStarted',
...@@ -74,7 +74,7 @@ describe('delete_milestone_modal.vue', () => { ...@@ -74,7 +74,7 @@ describe('delete_milestone_modal.vue', () => {
}); });
vm.onSubmit() vm.onSubmit()
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(redirectTo).not.toHaveBeenCalled(); expect(redirectTo).not.toHaveBeenCalled();
expect(eventHub.$emit).toHaveBeenCalledWith('deleteMilestoneModal.requestFinished', { expect(eventHub.$emit).toHaveBeenCalledWith('deleteMilestoneModal.requestFinished', {
......
...@@ -46,9 +46,9 @@ describe('Promote milestone modal', () => { ...@@ -46,9 +46,9 @@ describe('Promote milestone modal', () => {
vm.$destroy(); vm.$destroy();
}); });
it('redirects when a milestone is promoted', done => { it('redirects when a milestone is promoted', (done) => {
const responseURL = `${TEST_HOST}/dummy/endpoint`; const responseURL = `${TEST_HOST}/dummy/endpoint`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(milestoneMockData.url); expect(url).toBe(milestoneMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'promoteMilestoneModal.requestStarted', 'promoteMilestoneModal.requestStarted',
...@@ -72,10 +72,10 @@ describe('Promote milestone modal', () => { ...@@ -72,10 +72,10 @@ describe('Promote milestone modal', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('displays an error if promoting a milestone failed', done => { it('displays an error if promoting a milestone failed', (done) => {
const dummyError = new Error('promoting milestone failed'); const dummyError = new Error('promoting milestone failed');
dummyError.response = { status: 500 }; dummyError.response = { status: 500 };
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(milestoneMockData.url); expect(url).toBe(milestoneMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'promoteMilestoneModal.requestStarted', 'promoteMilestoneModal.requestStarted',
...@@ -85,7 +85,7 @@ describe('Promote milestone modal', () => { ...@@ -85,7 +85,7 @@ describe('Promote milestone modal', () => {
}); });
vm.onSubmit() vm.onSubmit()
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(eventHub.$emit).toHaveBeenCalledWith('promoteMilestoneModal.requestFinished', { expect(eventHub.$emit).toHaveBeenCalledWith('promoteMilestoneModal.requestFinished', {
milestoneUrl: milestoneMockData.url, milestoneUrl: milestoneMockData.url,
......
...@@ -46,7 +46,7 @@ describe('EmojiMenu', () => { ...@@ -46,7 +46,7 @@ describe('EmojiMenu', () => {
const dummyEmoji = 'tropical_fish'; const dummyEmoji = 'tropical_fish';
const dummyVotesBlock = () => $('<div />'); const dummyVotesBlock = () => $('<div />');
it('calls selectEmojiCallback', done => { it('calls selectEmojiCallback', (done) => {
expect(dummySelectEmojiCallback).not.toHaveBeenCalled(); expect(dummySelectEmojiCallback).not.toHaveBeenCalled();
emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => { emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => {
...@@ -55,7 +55,7 @@ describe('EmojiMenu', () => { ...@@ -55,7 +55,7 @@ describe('EmojiMenu', () => {
}); });
}); });
it('does not make an axios request', done => { it('does not make an axios request', (done) => {
jest.spyOn(axios, 'request').mockReturnValue(); jest.spyOn(axios, 'request').mockReturnValue();
emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => { emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => {
......
...@@ -30,7 +30,7 @@ describe('Fork groups list item component', () => { ...@@ -30,7 +30,7 @@ describe('Fork groups list item component', () => {
const DUMMY_PATH = '/dummy/path'; const DUMMY_PATH = '/dummy/path';
const createWrapper = propsData => { const createWrapper = (propsData) => {
wrapper = shallowMount(ForkGroupsListItem, { wrapper = shallowMount(ForkGroupsListItem, {
propsData: { propsData: {
...DEFAULT_PROPS, ...DEFAULT_PROPS,
...@@ -70,7 +70,7 @@ describe('Fork groups list item component', () => { ...@@ -70,7 +70,7 @@ describe('Fork groups list item component', () => {
expect( expect(
wrapper wrapper
.findAll(GlLink) .findAll(GlLink)
.filter(w => w.text() === DUMMY_FULL_NAME) .filter((w) => w.text() === DUMMY_FULL_NAME)
.at(0) .at(0)
.attributes().href, .attributes().href,
).toBe(DUMMY_PATH); ).toBe(DUMMY_PATH);
......
...@@ -21,7 +21,7 @@ describe('Fork groups list component', () => { ...@@ -21,7 +21,7 @@ describe('Fork groups list component', () => {
const replyWith = (...args) => axiosMock.onGet(DEFAULT_PROPS.endpoint).reply(...args); const replyWith = (...args) => axiosMock.onGet(DEFAULT_PROPS.endpoint).reply(...args);
const createWrapper = propsData => { const createWrapper = (propsData) => {
wrapper = shallowMount(ForkGroupsList, { wrapper = shallowMount(ForkGroupsList, {
propsData: { propsData: {
...DEFAULT_PROPS, ...DEFAULT_PROPS,
......
...@@ -26,7 +26,7 @@ describe('Interval Pattern Input Component', () => { ...@@ -26,7 +26,7 @@ describe('Interval Pattern Input Component', () => {
const findCustomInput = () => wrapper.find('#schedule_cron'); const findCustomInput = () => wrapper.find('#schedule_cron');
const findAllLabels = () => wrapper.findAll('label'); const findAllLabels = () => wrapper.findAll('label');
const findSelectedRadio = () => const findSelectedRadio = () =>
wrapper.findAll('input[type="radio"]').wrappers.find(x => x.element.checked); wrapper.findAll('input[type="radio"]').wrappers.find((x) => x.element.checked);
const findSelectedRadioKey = () => findSelectedRadio()?.attributes('data-testid'); const findSelectedRadioKey = () => findSelectedRadio()?.attributes('data-testid');
const selectEveryDayRadio = () => findEveryDayRadio().trigger('click'); const selectEveryDayRadio = () => findEveryDayRadio().trigger('click');
const selectEveryWeekRadio = () => findEveryWeekRadio().trigger('click'); const selectEveryWeekRadio = () => findEveryWeekRadio().trigger('click');
...@@ -129,7 +129,7 @@ describe('Interval Pattern Input Component', () => { ...@@ -129,7 +129,7 @@ describe('Interval Pattern Input Component', () => {
}); });
it('renders each label for radio options properly', () => { it('renders each label for radio options properly', () => {
const labels = findAllLabels().wrappers.map(el => trimText(el.text())); const labels = findAllLabels().wrappers.map((el) => trimText(el.text()));
expect(labels).toEqual([ expect(labels).toEqual([
'Every day (at 4:00am)', 'Every day (at 4:00am)',
......
...@@ -47,7 +47,7 @@ describe('Timezone Dropdown', () => { ...@@ -47,7 +47,7 @@ describe('Timezone Dropdown', () => {
const data = $dropdownEl.data('data'); const data = $dropdownEl.data('data');
const formatted = $wrapper.find(tzListSel).text(); const formatted = $wrapper.find(tzListSel).text();
data.forEach(item => { data.forEach((item) => {
expect(formatted).toContain(formatTimezone(item)); expect(formatted).toContain(formatTimezone(item));
}); });
}); });
...@@ -100,7 +100,7 @@ describe('Timezone Dropdown', () => { ...@@ -100,7 +100,7 @@ describe('Timezone Dropdown', () => {
new TimezoneDropdown({ new TimezoneDropdown({
$inputEl, $inputEl,
$dropdownEl, $dropdownEl,
displayFormat: selectedItem => formatTimezone(selectedItem), displayFormat: (selectedItem) => formatTimezone(selectedItem),
}); });
expect($wrapper.find(tzDropdownToggleText).html()).toEqual('[UTC - 2.5] Newfoundland'); expect($wrapper.find(tzDropdownToggleText).html()).toEqual('[UTC - 2.5] Newfoundland');
......
...@@ -19,7 +19,7 @@ describe('Project Feature Settings', () => { ...@@ -19,7 +19,7 @@ describe('Project Feature Settings', () => {
}; };
let wrapper; let wrapper;
const mountComponent = customProps => { const mountComponent = (customProps) => {
const propsData = { ...defaultProps, ...customProps }; const propsData = { ...defaultProps, ...customProps };
return shallowMount(projectFeatureSetting, { propsData }); return shallowMount(projectFeatureSetting, { propsData });
}; };
......
...@@ -367,7 +367,7 @@ describe('Settings Panel', () => { ...@@ -367,7 +367,7 @@ describe('Settings Panel', () => {
const repositoryFeatureToggleButton = findRepositoryFeatureSetting().find('button'); const repositoryFeatureToggleButton = findRepositoryFeatureSetting().find('button');
const lfsFeatureToggleButton = findLFSFeatureToggle().find('button'); const lfsFeatureToggleButton = findLFSFeatureToggle().find('button');
const isToggleButtonChecked = toggleButton => toggleButton.classes('is-checked'); const isToggleButtonChecked = (toggleButton) => toggleButton.classes('is-checked');
// assert the initial state // assert the initial state
expect(isToggleButtonChecked(lfsFeatureToggleButton)).toBe(true); expect(isToggleButtonChecked(lfsFeatureToggleButton)).toBe(true);
......
...@@ -4,7 +4,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -4,7 +4,7 @@ import axios from '~/lib/utils/axios_utils';
import refreshCounts from '~/pages/search/show/refresh_counts'; import refreshCounts from '~/pages/search/show/refresh_counts';
const URL = `${TEST_HOST}/search/count?search=lorem+ipsum&project_id=3`; const URL = `${TEST_HOST}/search/count?search=lorem+ipsum&project_id=3`;
const urlWithScope = scope => `${URL}&scope=${scope}`; const urlWithScope = (scope) => `${URL}&scope=${scope}`;
const counts = [ const counts = [
{ scope: 'issues', count: 4 }, { scope: 'issues', count: 4 },
{ scope: 'merge_requests', count: 5 }, { scope: 'merge_requests', count: 5 },
......
...@@ -2,7 +2,7 @@ import $ from 'jquery'; ...@@ -2,7 +2,7 @@ import $ from 'jquery';
import preserveUrlFragment from '~/pages/sessions/new/preserve_url_fragment'; import preserveUrlFragment from '~/pages/sessions/new/preserve_url_fragment';
describe('preserve_url_fragment', () => { describe('preserve_url_fragment', () => {
const findFormAction = selector => { const findFormAction = (selector) => {
return $(`.omniauth-container ${selector}`).parent('form').attr('action'); return $(`.omniauth-container ${selector}`).parent('form').attr('action');
}; };
......
...@@ -56,7 +56,7 @@ describe('SigninTabsMemoizer', () => { ...@@ -56,7 +56,7 @@ describe('SigninTabsMemoizer', () => {
}; };
jest jest
.spyOn(document, 'querySelector') .spyOn(document, 'querySelector')
.mockImplementation(selector => .mockImplementation((selector) =>
selector === `${tabSelector} a[href="#bogus"]` ? null : fakeTab, selector === `${tabSelector} a[href="#bogus"]` ? null : fakeTab,
); );
......
...@@ -14,7 +14,7 @@ const Component = Vue.extend(PDFLab); ...@@ -14,7 +14,7 @@ const Component = Vue.extend(PDFLab);
describe('PDF component', () => { describe('PDF component', () => {
let vm; let vm;
const checkLoaded = done => { const checkLoaded = (done) => {
if (vm.loading) { if (vm.loading) {
setTimeout(() => { setTimeout(() => {
checkLoaded(done); checkLoaded(done);
...@@ -25,7 +25,7 @@ describe('PDF component', () => { ...@@ -25,7 +25,7 @@ describe('PDF component', () => {
}; };
describe('without PDF data', () => { describe('without PDF data', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
pdf: '', pdf: '',
...@@ -43,7 +43,7 @@ describe('PDF component', () => { ...@@ -43,7 +43,7 @@ describe('PDF component', () => {
}); });
describe('with PDF data', () => { describe('with PDF data', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
pdf, pdf,
......
...@@ -14,7 +14,7 @@ describe('Page component', () => { ...@@ -14,7 +14,7 @@ describe('Page component', () => {
vm.$destroy(); vm.$destroy();
}); });
it('renders the page when mounting', done => { it('renders the page when mounting', (done) => {
const promise = Promise.resolve(); const promise = Promise.resolve();
const testPage = { const testPage = {
render: jest.fn().mockReturnValue({ promise: Promise.resolve() }), render: jest.fn().mockReturnValue({ promise: Promise.resolve() }),
......
...@@ -7,7 +7,7 @@ import RequestWarning from '~/performance_bar/components/request_warning.vue'; ...@@ -7,7 +7,7 @@ import RequestWarning from '~/performance_bar/components/request_warning.vue';
describe('detailedMetric', () => { describe('detailedMetric', () => {
let wrapper; let wrapper;
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(DetailedMetric, { wrapper = shallowMount(DetailedMetric, {
propsData: { propsData: {
...props, ...props,
...@@ -16,9 +16,9 @@ describe('detailedMetric', () => { ...@@ -16,9 +16,9 @@ describe('detailedMetric', () => {
}; };
const findAllTraceBlocks = () => wrapper.findAll('pre'); const findAllTraceBlocks = () => wrapper.findAll('pre');
const findTraceBlockAtIndex = index => findAllTraceBlocks().at(index); const findTraceBlockAtIndex = (index) => findAllTraceBlocks().at(index);
const findExpandBacktraceBtns = () => wrapper.findAll('[data-testid="backtrace-expand-btn"]'); const findExpandBacktraceBtns = () => wrapper.findAll('[data-testid="backtrace-expand-btn"]');
const findExpandedBacktraceBtnAtIndex = index => findExpandBacktraceBtns().at(index); const findExpandedBacktraceBtnAtIndex = (index) => findExpandBacktraceBtns().at(index);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -95,7 +95,7 @@ describe('detailedMetric', () => { ...@@ -95,7 +95,7 @@ describe('detailedMetric', () => {
expect(wrapper.find('.js-toggle-button')).not.toBeNull(); expect(wrapper.find('.js-toggle-button')).not.toBeNull();
wrapper.findAll('.performance-bar-modal td:nth-child(2)').wrappers.forEach(request => { wrapper.findAll('.performance-bar-modal td:nth-child(2)').wrappers.forEach((request) => {
expect(request.text()).toContain('world'); expect(request.text()).toContain('world');
}); });
}); });
......
...@@ -3,7 +3,7 @@ import PerformanceBarStore from '~/performance_bar/stores/performance_bar_store' ...@@ -3,7 +3,7 @@ import PerformanceBarStore from '~/performance_bar/stores/performance_bar_store'
describe('PerformanceBarStore', () => { describe('PerformanceBarStore', () => {
describe('truncateUrl', () => { describe('truncateUrl', () => {
let store; let store;
const findUrl = id => store.findRequest(id).truncatedUrl; const findUrl = (id) => store.findRequest(id).truncatedUrl;
beforeEach(() => { beforeEach(() => {
store = new PerformanceBarStore(); store = new PerformanceBarStore();
......
...@@ -5,7 +5,7 @@ import { CI_CONFIG_STATUS_INVALID } from '~/pipeline_editor/constants'; ...@@ -5,7 +5,7 @@ import { CI_CONFIG_STATUS_INVALID } from '~/pipeline_editor/constants';
import { mockCiConfigQueryResponse, mockLintHelpPagePath } from '../../mock_data'; import { mockCiConfigQueryResponse, mockLintHelpPagePath } from '../../mock_data';
import { unwrapStagesWithNeeds } from '~/pipelines/components/unwrapping_utils'; import { unwrapStagesWithNeeds } from '~/pipelines/components/unwrapping_utils';
const getCiConfig = mergedConfig => { const getCiConfig = (mergedConfig) => {
const { ciConfig } = mockCiConfigQueryResponse.data; const { ciConfig } = mockCiConfigQueryResponse.data;
return { return {
...ciConfig, ...ciConfig,
...@@ -29,10 +29,10 @@ describe('~/pipeline_editor/components/lint/ci_lint.vue', () => { ...@@ -29,10 +29,10 @@ describe('~/pipeline_editor/components/lint/ci_lint.vue', () => {
}); });
}; };
const findAllByTestId = selector => wrapper.findAll(`[data-testid="${selector}"]`); const findAllByTestId = (selector) => wrapper.findAll(`[data-testid="${selector}"]`);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findLintParameters = () => findAllByTestId('ci-lint-parameter'); const findLintParameters = () => findAllByTestId('ci-lint-parameter');
const findLintParameterAt = i => findLintParameters().at(i); const findLintParameterAt = (i) => findLintParameters().at(i);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -139,7 +139,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -139,7 +139,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findTabAt = i => wrapper.findAll(GlTab).at(i); const findTabAt = (i) => wrapper.findAll(GlTab).at(i);
const findVisualizationTab = () => wrapper.find('[data-testid="visualization-tab"]'); const findVisualizationTab = () => wrapper.find('[data-testid="visualization-tab"]');
const findTextEditor = () => wrapper.find(TextEditor); const findTextEditor = () => wrapper.find(TextEditor);
const findEditorLite = () => wrapper.find(MockEditorLite); const findEditorLite = () => wrapper.find(MockEditorLite);
...@@ -255,7 +255,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -255,7 +255,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
startBranch: mockDefaultBranch, startBranch: mockDefaultBranch,
}; };
const findInForm = selector => findCommitForm().find(selector); const findInForm = (selector) => findCommitForm().find(selector);
const submitCommit = async ({ const submitCommit = async ({
message = mockCommitMessage, message = mockCommitMessage,
......
...@@ -44,7 +44,7 @@ describe('Pipeline New Form', () => { ...@@ -44,7 +44,7 @@ describe('Pipeline New Form', () => {
const findWarnings = () => wrapper.findAll('[data-testid="run-pipeline-warning"]'); const findWarnings = () => wrapper.findAll('[data-testid="run-pipeline-warning"]');
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const getExpectedPostParams = () => JSON.parse(mock.history.post[0].data); const getExpectedPostParams = () => JSON.parse(mock.history.post[0].data);
const changeRef = i => findDropdownItems().at(i).vm.$emit('click'); const changeRef = (i) => findDropdownItems().at(i).vm.$emit('click');
const createComponent = (term = '', props = {}, method = shallowMount) => { const createComponent = (term = '', props = {}, method = shallowMount) => {
wrapper = method(PipelineNewForm, { wrapper = method(PipelineNewForm, {
......
...@@ -94,7 +94,7 @@ describe('The DAG graph', () => { ...@@ -94,7 +94,7 @@ describe('The DAG graph', () => {
}); });
describe('interactions', () => { describe('interactions', () => {
const strokeOpacity = opacity => `stroke-opacity: ${opacity};`; const strokeOpacity = (opacity) => `stroke-opacity: ${opacity};`;
const baseOpacity = () => wrapper.vm.$options.viewOptions.baseOpacity; const baseOpacity = () => wrapper.vm.$options.viewOptions.baseOpacity;
describe('links', () => { describe('links', () => {
...@@ -164,10 +164,10 @@ describe('The DAG graph', () => { ...@@ -164,10 +164,10 @@ describe('The DAG graph', () => {
describe('nodes', () => { describe('nodes', () => {
const liveNode = () => getAllNodes().at(10); const liveNode = () => getAllNodes().at(10);
const anotherLiveNode = () => getAllNodes().at(5); const anotherLiveNode = () => getAllNodes().at(5);
const nodesNotHighlighted = () => getAllNodes().filter(n => !n.classes(IS_HIGHLIGHTED)); const nodesNotHighlighted = () => getAllNodes().filter((n) => !n.classes(IS_HIGHLIGHTED));
const linksNotHighlighted = () => getAllLinks().filter(n => !n.classes(IS_HIGHLIGHTED)); const linksNotHighlighted = () => getAllLinks().filter((n) => !n.classes(IS_HIGHLIGHTED));
const nodesHighlighted = () => getAllNodes().filter(n => n.classes(IS_HIGHLIGHTED)); const nodesHighlighted = () => getAllNodes().filter((n) => n.classes(IS_HIGHLIGHTED));
const linksHighlighted = () => getAllLinks().filter(n => n.classes(IS_HIGHLIGHTED)); const linksHighlighted = () => getAllLinks().filter((n) => n.classes(IS_HIGHLIGHTED));
describe('on click', () => { describe('on click', () => {
it('highlights the clicked node and predecessors', () => { it('highlights the clicked node and predecessors', () => {
...@@ -176,19 +176,19 @@ describe('The DAG graph', () => { ...@@ -176,19 +176,19 @@ describe('The DAG graph', () => {
expect(nodesNotHighlighted().length < getAllNodes().length).toBe(true); expect(nodesNotHighlighted().length < getAllNodes().length).toBe(true);
expect(linksNotHighlighted().length < getAllLinks().length).toBe(true); expect(linksNotHighlighted().length < getAllLinks().length).toBe(true);
linksHighlighted().wrappers.forEach(link => { linksHighlighted().wrappers.forEach((link) => {
expect(link.attributes('style')).toBe(strokeOpacity(highlightIn)); expect(link.attributes('style')).toBe(strokeOpacity(highlightIn));
}); });
nodesHighlighted().wrappers.forEach(node => { nodesHighlighted().wrappers.forEach((node) => {
expect(node.attributes('stroke')).not.toBe('#f2f2f2'); expect(node.attributes('stroke')).not.toBe('#f2f2f2');
}); });
linksNotHighlighted().wrappers.forEach(link => { linksNotHighlighted().wrappers.forEach((link) => {
expect(link.attributes('style')).toBe(strokeOpacity(highlightOut)); expect(link.attributes('style')).toBe(strokeOpacity(highlightOut));
}); });
nodesNotHighlighted().wrappers.forEach(node => { nodesNotHighlighted().wrappers.forEach((node) => {
expect(node.attributes('stroke')).toBe('#f2f2f2'); expect(node.attributes('stroke')).toBe('#f2f2f2');
}); });
}); });
......
...@@ -21,7 +21,7 @@ describe('Pipeline DAG graph wrapper', () => { ...@@ -21,7 +21,7 @@ describe('Pipeline DAG graph wrapper', () => {
const getAllAlerts = () => wrapper.findAll(GlAlert); const getAllAlerts = () => wrapper.findAll(GlAlert);
const getGraph = () => wrapper.find(DagGraph); const getGraph = () => wrapper.find(DagGraph);
const getNotes = () => wrapper.find(DagAnnotations); const getNotes = () => wrapper.find(DagAnnotations);
const getErrorText = type => wrapper.vm.$options.errorTexts[type]; const getErrorText = (type) => wrapper.vm.$options.errorTexts[type];
const getEmptyState = () => wrapper.find(GlEmptyState); const getEmptyState = () => wrapper.find(GlEmptyState);
const createComponent = ({ const createComponent = ({
......
...@@ -11,10 +11,10 @@ describe('Pipelines filtered search', () => { ...@@ -11,10 +11,10 @@ describe('Pipelines filtered search', () => {
let mock; let mock;
const findFilteredSearch = () => wrapper.find(GlFilteredSearch); const findFilteredSearch = () => wrapper.find(GlFilteredSearch);
const getSearchToken = type => const getSearchToken = (type) =>
findFilteredSearch() findFilteredSearch()
.props('availableTokens') .props('availableTokens')
.find(token => token.type === type); .find((token) => token.type === type);
const findBranchToken = () => getSearchToken('ref'); const findBranchToken = () => getSearchToken('ref');
const findTagToken = () => getSearchToken('tag'); const findTagToken = () => getSearchToken('tag');
const findUserToken = () => getSearchToken('username'); const findUserToken = () => getSearchToken('username');
......
...@@ -33,7 +33,7 @@ describe('pipeline graph action component', () => { ...@@ -33,7 +33,7 @@ describe('pipeline graph action component', () => {
expect(wrapper.attributes('title')).toBe('bar'); expect(wrapper.attributes('title')).toBe('bar');
}); });
it('should update bootstrap tooltip when title changes', done => { it('should update bootstrap tooltip when title changes', (done) => {
wrapper.setProps({ tooltipText: 'changed' }); wrapper.setProps({ tooltipText: 'changed' });
wrapper.vm wrapper.vm
...@@ -51,7 +51,7 @@ describe('pipeline graph action component', () => { ...@@ -51,7 +51,7 @@ describe('pipeline graph action component', () => {
}); });
describe('on click', () => { describe('on click', () => {
it('emits `pipelineActionRequestComplete` after a successful request', done => { it('emits `pipelineActionRequestComplete` after a successful request', (done) => {
jest.spyOn(wrapper.vm, '$emit'); jest.spyOn(wrapper.vm, '$emit');
findButton().trigger('click'); findButton().trigger('click');
...@@ -64,7 +64,7 @@ describe('pipeline graph action component', () => { ...@@ -64,7 +64,7 @@ describe('pipeline graph action component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('renders a loading icon while waiting for request', done => { it('renders a loading icon while waiting for request', (done) => {
findButton().trigger('click'); findButton().trigger('click');
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
......
...@@ -18,7 +18,7 @@ describe('graph component', () => { ...@@ -18,7 +18,7 @@ describe('graph component', () => {
const findExpandPipelineBtn = () => wrapper.find('[data-testid="expand-pipeline-button"]'); const findExpandPipelineBtn = () => wrapper.find('[data-testid="expand-pipeline-button"]');
const findAllExpandPipelineBtns = () => wrapper.findAll('[data-testid="expand-pipeline-button"]'); const findAllExpandPipelineBtns = () => wrapper.findAll('[data-testid="expand-pipeline-button"]');
const findStageColumns = () => wrapper.findAll(StageColumnComponentLegacy); const findStageColumns = () => wrapper.findAll(StageColumnComponentLegacy);
const findStageColumnAt = i => findStageColumns().at(i); const findStageColumnAt = (i) => findStageColumns().at(i);
beforeEach(() => { beforeEach(() => {
mediator = new PipelinesMediator({ endpoint: '' }); mediator = new PipelinesMediator({ endpoint: '' });
...@@ -167,7 +167,7 @@ describe('graph component', () => { ...@@ -167,7 +167,7 @@ describe('graph component', () => {
}); });
describe('with expanded pipeline', () => { describe('with expanded pipeline', () => {
it('should render expanded pipeline', done => { it('should render expanded pipeline', (done) => {
// expand the pipeline // expand the pipeline
store.state.pipeline.triggered_by[0].isExpanded = true; store.state.pipeline.triggered_by[0].isExpanded = true;
...@@ -212,7 +212,7 @@ describe('graph component', () => { ...@@ -212,7 +212,7 @@ describe('graph component', () => {
}); });
describe('with expanded pipeline', () => { describe('with expanded pipeline', () => {
it('should render expanded pipeline', done => { it('should render expanded pipeline', (done) => {
// expand the pipeline // expand the pipeline
store.state.pipeline.triggered[0].isExpanded = true; store.state.pipeline.triggered[0].isExpanded = true;
......
...@@ -7,7 +7,7 @@ describe('pipeline graph job item', () => { ...@@ -7,7 +7,7 @@ describe('pipeline graph job item', () => {
const findJobWithoutLink = () => wrapper.find('[data-testid="job-without-link"]'); const findJobWithoutLink = () => wrapper.find('[data-testid="job-without-link"]');
const findJobWithLink = () => wrapper.find('[data-testid="job-with-link"]'); const findJobWithLink = () => wrapper.find('[data-testid="job-with-link"]');
const createWrapper = propsData => { const createWrapper = (propsData) => {
wrapper = mount(JobItem, { wrapper = mount(JobItem, {
propsData, propsData,
}); });
...@@ -52,7 +52,7 @@ describe('pipeline graph job item', () => { ...@@ -52,7 +52,7 @@ describe('pipeline graph job item', () => {
}); });
describe('name with link', () => { describe('name with link', () => {
it('should render the job name and status with a link', done => { it('should render the job name and status with a link', (done) => {
createWrapper({ job: mockJob }); createWrapper({ job: mockJob });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
......
...@@ -656,7 +656,7 @@ export const wrappedPipelineReturn = { ...@@ -656,7 +656,7 @@ export const wrappedPipelineReturn = {
export const generateResponse = (raw, mockPath) => unwrapPipelineData(mockPath, raw.data); export const generateResponse = (raw, mockPath) => unwrapPipelineData(mockPath, raw.data);
export const pipelineWithUpstreamDownstream = base => { export const pipelineWithUpstreamDownstream = (base) => {
const pip = { ...base }; const pip = { ...base };
pip.data.project.pipeline.downstream = downstream; pip.data.project.pipeline.downstream = downstream;
pip.data.project.pipeline.upstream = upstream; pip.data.project.pipeline.upstream = upstream;
......
...@@ -23,7 +23,7 @@ describe('pipeline graph component', () => { ...@@ -23,7 +23,7 @@ describe('pipeline graph component', () => {
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findAllStagePills = () => wrapper.findAll(StagePill); const findAllStagePills = () => wrapper.findAll(StagePill);
const findAllStageBackgroundElements = () => wrapper.findAll('[data-testid="stage-background"]'); const findAllStageBackgroundElements = () => wrapper.findAll('[data-testid="stage-background"]');
const findStageBackgroundElementAt = index => findAllStageBackgroundElements().at(index); const findStageBackgroundElementAt = (index) => findAllStageBackgroundElements().at(index);
const findAllJobPills = () => wrapper.findAll(JobPill); const findAllJobPills = () => wrapper.findAll(JobPill);
afterEach(() => { afterEach(() => {
......
...@@ -28,7 +28,7 @@ describe('Pipeline Url Component', () => { ...@@ -28,7 +28,7 @@ describe('Pipeline Url Component', () => {
pipelineScheduleUrl: 'foo', pipelineScheduleUrl: 'foo',
}; };
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(PipelineUrlComponent, { wrapper = shallowMount(PipelineUrlComponent, {
propsData: { ...defaultProps, ...props }, propsData: { ...defaultProps, ...props },
provide: { provide: {
......
...@@ -57,10 +57,10 @@ describe('Pipelines', () => { ...@@ -57,10 +57,10 @@ describe('Pipelines', () => {
}; };
const findFilteredSearch = () => wrapper.find(GlFilteredSearch); const findFilteredSearch = () => wrapper.find(GlFilteredSearch);
const findByTestId = id => wrapper.find(`[data-testid="${id}"]`); const findByTestId = (id) => wrapper.find(`[data-testid="${id}"]`);
const findNavigationTabs = () => wrapper.find(NavigationTabs); const findNavigationTabs = () => wrapper.find(NavigationTabs);
const findNavigationControls = () => wrapper.find(NavigationControls); const findNavigationControls = () => wrapper.find(NavigationControls);
const findTab = tab => findByTestId(`pipelines-tab-${tab}`); const findTab = (tab) => findByTestId(`pipelines-tab-${tab}`);
const findRunPipelineButton = () => findByTestId('run-pipeline-button'); const findRunPipelineButton = () => findByTestId('run-pipeline-button');
const findCiLintButton = () => findByTestId('ci-lint-button'); const findCiLintButton = () => findByTestId('ci-lint-button');
......
...@@ -5,7 +5,7 @@ import eventHub from '~/pipelines/event_hub'; ...@@ -5,7 +5,7 @@ import eventHub from '~/pipelines/event_hub';
describe('Pipelines Table Row', () => { describe('Pipelines Table Row', () => {
const jsonFixtureName = 'pipelines/pipelines.json'; const jsonFixtureName = 'pipelines/pipelines.json';
const createWrapper = pipeline => const createWrapper = (pipeline) =>
mount(PipelinesTableRowComponent, { mount(PipelinesTableRowComponent, {
propsData: { propsData: {
pipeline, pipeline,
...@@ -24,9 +24,9 @@ describe('Pipelines Table Row', () => { ...@@ -24,9 +24,9 @@ describe('Pipelines Table Row', () => {
beforeEach(() => { beforeEach(() => {
const { pipelines } = getJSONFixture(jsonFixtureName); const { pipelines } = getJSONFixture(jsonFixtureName);
pipeline = pipelines.find(p => p.user !== null && p.commit !== null); pipeline = pipelines.find((p) => p.user !== null && p.commit !== null);
pipelineWithoutAuthor = pipelines.find(p => p.user === null && p.commit !== null); pipelineWithoutAuthor = pipelines.find((p) => p.user === null && p.commit !== null);
pipelineWithoutCommit = pipelines.find(p => p.user === null && p.commit === null); pipelineWithoutCommit = pipelines.find((p) => p.user === null && p.commit === null);
}); });
afterEach(() => { afterEach(() => {
...@@ -187,7 +187,7 @@ describe('Pipelines Table Row', () => { ...@@ -187,7 +187,7 @@ describe('Pipelines Table Row', () => {
}); });
it('emits `retryPipeline` event when retry button is clicked and toggles loading', () => { it('emits `retryPipeline` event when retry button is clicked and toggles loading', () => {
eventHub.$on('retryPipeline', endpoint => { eventHub.$on('retryPipeline', (endpoint) => {
expect(endpoint).toBe('/retry'); expect(endpoint).toBe('/retry');
}); });
...@@ -196,7 +196,7 @@ describe('Pipelines Table Row', () => { ...@@ -196,7 +196,7 @@ describe('Pipelines Table Row', () => {
}); });
it('emits `openConfirmationModal` event when cancel button is clicked and toggles loading', () => { it('emits `openConfirmationModal` event when cancel button is clicked and toggles loading', () => {
eventHub.$once('openConfirmationModal', data => { eventHub.$once('openConfirmationModal', (data) => {
const { id, ref, commit } = pipeline; const { id, ref, commit } = pipeline;
expect(data.endpoint).toBe('/cancel'); expect(data.endpoint).toBe('/cancel');
...@@ -212,7 +212,7 @@ describe('Pipelines Table Row', () => { ...@@ -212,7 +212,7 @@ describe('Pipelines Table Row', () => {
wrapper.find('.js-pipelines-cancel-button').trigger('click'); wrapper.find('.js-pipelines-cancel-button').trigger('click');
}); });
it('renders a loading icon when `cancelingPipeline` matches pipeline id', done => { it('renders a loading icon when `cancelingPipeline` matches pipeline id', (done) => {
wrapper.setProps({ cancelingPipeline: pipeline.id }); wrapper.setProps({ cancelingPipeline: pipeline.id });
wrapper.vm wrapper.vm
.$nextTick() .$nextTick()
......
...@@ -24,7 +24,7 @@ describe('Pipelines Table', () => { ...@@ -24,7 +24,7 @@ describe('Pipelines Table', () => {
beforeEach(() => { beforeEach(() => {
const { pipelines } = getJSONFixture(jsonFixtureName); const { pipelines } = getJSONFixture(jsonFixtureName);
pipeline = pipelines.find(p => p.user !== null && p.commit !== null); pipeline = pipelines.find((p) => p.user !== null && p.commit !== null);
createComponent(); createComponent();
}); });
......
...@@ -32,14 +32,14 @@ describe('EE Pipeline store', () => { ...@@ -32,14 +32,14 @@ describe('EE Pipeline store', () => {
describe('triggered', () => { describe('triggered', () => {
it('adds isExpanding & isLoading keys set to false for each triggered pipeline', () => { it('adds isExpanding & isLoading keys set to false for each triggered pipeline', () => {
store.state.pipeline.triggered.forEach(pipeline => { store.state.pipeline.triggered.forEach((pipeline) => {
expect(pipeline.isExpanded).toEqual(false); expect(pipeline.isExpanded).toEqual(false);
expect(pipeline.isLoading).toEqual(false); expect(pipeline.isLoading).toEqual(false);
}); });
}); });
it('parses nested triggered pipelines', () => { it('parses nested triggered pipelines', () => {
store.state.pipeline.triggered[1].triggered.forEach(pipeline => { store.state.pipeline.triggered[1].triggered.forEach((pipeline) => {
expect(pipeline.isExpanded).toEqual(false); expect(pipeline.isExpanded).toEqual(false);
expect(pipeline.isLoading).toEqual(false); expect(pipeline.isLoading).toEqual(false);
}); });
......
...@@ -39,7 +39,7 @@ describe('Actions TestReports Store', () => { ...@@ -39,7 +39,7 @@ describe('Actions TestReports Store', () => {
mock.onGet(summaryEndpoint).replyOnce(200, summary, {}); mock.onGet(summaryEndpoint).replyOnce(200, summary, {});
}); });
it('sets testReports and shows tests', done => { it('sets testReports and shows tests', (done) => {
testAction( testAction(
actions.fetchSummary, actions.fetchSummary,
null, null,
...@@ -50,7 +50,7 @@ describe('Actions TestReports Store', () => { ...@@ -50,7 +50,7 @@ describe('Actions TestReports Store', () => {
); );
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
testAction( testAction(
actions.fetchSummary, actions.fetchSummary,
null, null,
...@@ -75,7 +75,7 @@ describe('Actions TestReports Store', () => { ...@@ -75,7 +75,7 @@ describe('Actions TestReports Store', () => {
.replyOnce(200, testReports.test_suites[0], {}); .replyOnce(200, testReports.test_suites[0], {});
}); });
it('sets test suite and shows tests', done => { it('sets test suite and shows tests', (done) => {
const suite = testReports.test_suites[0]; const suite = testReports.test_suites[0];
const index = 0; const index = 0;
...@@ -89,7 +89,7 @@ describe('Actions TestReports Store', () => { ...@@ -89,7 +89,7 @@ describe('Actions TestReports Store', () => {
); );
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
const index = 0; const index = 0;
testAction( testAction(
...@@ -106,7 +106,7 @@ describe('Actions TestReports Store', () => { ...@@ -106,7 +106,7 @@ describe('Actions TestReports Store', () => {
}); });
describe('when we already have the suite data', () => { describe('when we already have the suite data', () => {
it('should not fetch suite', done => { it('should not fetch suite', (done) => {
const index = 0; const index = 0;
testReports.test_suites[0].hasFullSuite = true; testReports.test_suites[0].hasFullSuite = true;
...@@ -116,7 +116,7 @@ describe('Actions TestReports Store', () => { ...@@ -116,7 +116,7 @@ describe('Actions TestReports Store', () => {
}); });
describe('set selected suite index', () => { describe('set selected suite index', () => {
it('sets selectedSuiteIndex', done => { it('sets selectedSuiteIndex', (done) => {
const selectedSuiteIndex = 0; const selectedSuiteIndex = 0;
testAction( testAction(
...@@ -131,7 +131,7 @@ describe('Actions TestReports Store', () => { ...@@ -131,7 +131,7 @@ describe('Actions TestReports Store', () => {
}); });
describe('remove selected suite index', () => { describe('remove selected suite index', () => {
it('sets selectedSuiteIndex to null', done => { it('sets selectedSuiteIndex to null', (done) => {
testAction( testAction(
actions.removeSelectedSuiteIndex, actions.removeSelectedSuiteIndex,
{}, {},
...@@ -144,11 +144,11 @@ describe('Actions TestReports Store', () => { ...@@ -144,11 +144,11 @@ describe('Actions TestReports Store', () => {
}); });
describe('toggles loading', () => { describe('toggles loading', () => {
it('sets isLoading to true', done => { it('sets isLoading to true', (done) => {
testAction(actions.toggleLoading, {}, state, [{ type: types.TOGGLE_LOADING }], [], done); testAction(actions.toggleLoading, {}, state, [{ type: types.TOGGLE_LOADING }], [], done);
}); });
it('toggles isLoading to false', done => { it('toggles isLoading to false', (done) => {
testAction( testAction(
actions.toggleLoading, actions.toggleLoading,
{}, {},
......
...@@ -40,7 +40,7 @@ describe('Getters TestReports Store', () => { ...@@ -40,7 +40,7 @@ describe('Getters TestReports Store', () => {
setupState(); setupState();
const suites = getters.getTestSuites(state); const suites = getters.getTestSuites(state);
const expected = testReports.test_suites.map(x => ({ const expected = testReports.test_suites.map((x) => ({
...x, ...x,
formattedTime: formattedTime(x.total_time), formattedTime: formattedTime(x.total_time),
})); }));
...@@ -72,7 +72,7 @@ describe('Getters TestReports Store', () => { ...@@ -72,7 +72,7 @@ describe('Getters TestReports Store', () => {
const cases = getters.getSuiteTests(state); const cases = getters.getSuiteTests(state);
const expected = testReports.test_suites[0].test_cases const expected = testReports.test_suites[0].test_cases
.map(x => ({ .map((x) => ({
...x, ...x,
formattedTime: formattedTime(x.execution_time), formattedTime: formattedTime(x.execution_time),
icon: iconForTestStatus(x.status), icon: iconForTestStatus(x.status),
......
...@@ -23,7 +23,7 @@ describe('Test reports suite table', () => { ...@@ -23,7 +23,7 @@ describe('Test reports suite table', () => {
const noCasesMessage = () => wrapper.find('.js-no-test-cases'); const noCasesMessage = () => wrapper.find('.js-no-test-cases');
const allCaseRows = () => wrapper.findAll('.js-case-row'); const allCaseRows = () => wrapper.findAll('.js-case-row');
const findCaseRowAtIndex = index => wrapper.findAll('.js-case-row').at(index); const findCaseRowAtIndex = (index) => wrapper.findAll('.js-case-row').at(index);
const findIconForRow = (row, status) => row.find(`.ci-status-icon-${status}`); const findIconForRow = (row, status) => row.find(`.ci-status-icon-${status}`);
const createComponent = (suite = testSuite, perPage = 20) => { const createComponent = (suite = testSuite, perPage = 20) => {
...@@ -73,8 +73,8 @@ describe('Test reports suite table', () => { ...@@ -73,8 +73,8 @@ describe('Test reports suite table', () => {
TestStatus.SKIPPED, TestStatus.SKIPPED,
TestStatus.SUCCESS, TestStatus.SUCCESS,
'unknown', 'unknown',
])('renders the correct icon for test case with %s status', status => { ])('renders the correct icon for test case with %s status', (status) => {
const test = testCases.findIndex(x => x.status === status); const test = testCases.findIndex((x) => x.status === status);
const row = findCaseRowAtIndex(test); const row = findCaseRowAtIndex(test);
expect(findIconForRow(row, status).exists()).toBe(true); expect(findIconForRow(row, status).exists()).toBe(true);
......
...@@ -22,7 +22,7 @@ describe('Test reports summary', () => { ...@@ -22,7 +22,7 @@ describe('Test reports summary', () => {
showBack: false, showBack: false,
}; };
const createComponent = props => { const createComponent = (props) => {
wrapper = mount(Summary, { wrapper = mount(Summary, {
propsData: { propsData: {
...defaultProps, ...defaultProps,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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