Commit 13130993 authored by Nathan Friend's avatar Nathan Friend

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

Format files with prettier arrowParens [10/15]

See merge request gitlab-org/gitlab!50537
parents 4ad3f344 99bff445
This diff is collapsed.
......@@ -29,7 +29,7 @@ const mutate = jest.fn().mockResolvedValue({
},
},
});
const mutateWithDataErrors = segment =>
const mutateWithDataErrors = (segment) =>
jest.fn().mockResolvedValue({
data: {
[segment ? 'updateDevopsAdoptionSegment' : 'createDevopsAdoptionSegment']: {
......@@ -64,13 +64,13 @@ describe('DevopsAdoptionSegmentModal', () => {
};
const findModal = () => wrapper.find(GlModal);
const findByTestId = testId => findModal().find(`[data-testid="${testId}"]`);
const findByTestId = (testId) => findModal().find(`[data-testid="${testId}"]`);
const actionButtonDisabledState = () => findModal().props('actionPrimary').attributes[0].disabled;
const cancelButtonDisabledState = () => findModal().props('actionCancel').attributes[0].disabled;
const actionButtonLoadingState = () => findModal().props('actionPrimary').attributes[0].loading;
const findAlert = () => findModal().find(GlAlert);
const assertHelperText = text => expect(getByText(wrapper.element, text)).not.toBeNull();
const assertHelperText = (text) => expect(getByText(wrapper.element, text)).not.toBeNull();
afterEach(() => {
wrapper.destroy();
......@@ -89,7 +89,7 @@ describe('DevopsAdoptionSegmentModal', () => {
describe('displays the correct content', () => {
beforeEach(() => createComponent());
const isCorrectShape = option => {
const isCorrectShape = (option) => {
const keys = Object.keys(option);
return keys.includes('label') && keys.includes('value');
};
......
......@@ -5,7 +5,7 @@ import DevopsAdoptionTableCellFlag from 'ee/admin/dev_ops_report/components/devo
describe('DevopsAdoptionTableCellFlag', () => {
let wrapper;
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(DevopsAdoptionTableCellFlag, {
propsData: {
enabled: true,
......
......@@ -31,7 +31,7 @@ describe('DevopsAdoptionTable', () => {
const findTable = () => wrapper.find(GlTable);
const findCol = testId => findTable().find(`[data-testid="${testId}"]`);
const findCol = (testId) => findTable().find(`[data-testid="${testId}"]`);
const findColRowChild = (col, row, child) =>
findTable().findAll(`[data-testid="${col}"]`).at(row).find(child);
......
......@@ -55,7 +55,7 @@ describe('CodeReviewAnalyticsApp component', () => {
},
});
const createComponent = store =>
const createComponent = (store) =>
shallowMount(CodeReviewAnalyticsApp, {
localVue,
store,
......
......@@ -102,10 +102,10 @@ describe('Filter bar', () => {
});
const findFilteredSearch = () => wrapper.find(FilteredSearchBar);
const getSearchToken = type =>
const getSearchToken = (type) =>
findFilteredSearch()
.props('tokens')
.find(token => token.type === type);
.find((token) => token.type === type);
describe('default', () => {
beforeEach(() => {
......
......@@ -25,13 +25,13 @@ describe('MergeRequestTable component', () => {
},
});
const createComponent = store =>
const createComponent = (store) =>
mount(MergeRequestTable, {
localVue,
store,
});
const bootstrap = initialState => {
const bootstrap = (initialState) => {
vuexStore = createStore(initialState);
wrapper = createComponent(vuexStore);
};
......@@ -41,8 +41,8 @@ describe('MergeRequestTable component', () => {
});
const findTable = () => wrapper.find(GlTable);
const findTableRow = index => findTable().findAll('tbody tr').at(index);
const findReviewTimeCol = rowIndex => findTableRow(rowIndex).findAll('td').at(1);
const findTableRow = (index) => findTable().findAll('tbody tr').at(index);
const findReviewTimeCol = (rowIndex) => findTableRow(rowIndex).findAll('td').at(1);
const updateMergeRequests = (index, attrs) =>
mockMergeRequests.map((item, idx) => {
......
......@@ -91,7 +91,7 @@ describe('Code review analytics mergeRequests actions', () => {
mock.onGet(/api\/(.*)\/analytics\/code_review/).replyOnce(500);
});
it('dispatches error', done => {
it('dispatches error', (done) => {
testAction(
actions.fetchMergeRequests,
null,
......
......@@ -152,48 +152,48 @@ describe('Value Stream Analytics component', () => {
return comp;
}
const findStageNavItemAtIndex = index =>
const findStageNavItemAtIndex = (index) =>
wrapper.find(StageTableNav).findAll(StageNavItem).at(index);
const findAddStageButton = () => wrapper.find(AddStageButton);
const displaysProjectsDropdownFilter = flag => {
const displaysProjectsDropdownFilter = (flag) => {
expect(wrapper.find(ProjectsDropdownFilter).exists()).toBe(flag);
};
const displaysDateRangePicker = flag => {
const displaysDateRangePicker = (flag) => {
expect(wrapper.find(Daterange).exists()).toBe(flag);
};
const displaysMetrics = flag => {
const displaysMetrics = (flag) => {
expect(wrapper.find(Metrics).exists()).toBe(flag);
};
const displaysStageTable = flag => {
const displaysStageTable = (flag) => {
expect(wrapper.find(StageTable).exists()).toBe(flag);
};
const displaysDurationChart = flag => {
const displaysDurationChart = (flag) => {
expect(wrapper.find(DurationChart).exists()).toBe(flag);
};
const displaysTypeOfWork = flag => {
const displaysTypeOfWork = (flag) => {
expect(wrapper.find(TypeOfWorkCharts).exists()).toBe(flag);
};
const displaysPathNavigation = flag => {
const displaysPathNavigation = (flag) => {
expect(wrapper.find(PathNavigation).exists()).toBe(flag);
};
const displaysAddStageButton = flag => {
const displaysAddStageButton = (flag) => {
expect(wrapper.find(AddStageButton).exists()).toBe(flag);
};
const displaysFilterBar = flag => {
const displaysFilterBar = (flag) => {
expect(wrapper.find(FilterBar).exists()).toBe(flag);
};
const displaysValueStreamSelect = flag => {
const displaysValueStreamSelect = (flag) => {
expect(wrapper.find(ValueStreamSelect).exists()).toBe(flag);
};
......@@ -548,7 +548,7 @@ describe('Value Stream Analytics component', () => {
});
const findFlashError = () => document.querySelector('.flash-container .flash-text');
const findError = async msg => {
const findError = async (msg) => {
await waitForPromises();
expect(findFlashError().innerText.trim()).toEqual(msg);
};
......
......@@ -12,17 +12,17 @@ import {
customStageStopEvents as endEvents,
} from '../../mock_data';
const formatStartEventOpts = _events => [
const formatStartEventOpts = (_events) => [
{ text: 'Select start event', value: null },
..._events
.filter(ev => ev.canBeStartEvent)
.filter((ev) => ev.canBeStartEvent)
.map(({ name: text, identifier: value }) => ({ text, value })),
];
const formatEndEventOpts = _events => [
const formatEndEventOpts = (_events) => [
{ text: 'Select end event', value: null },
..._events
.filter(ev => !ev.canBeStartEvent)
.filter((ev) => !ev.canBeStartEvent)
.map(({ name: text, identifier: value }) => ({ text, value })),
];
......@@ -54,8 +54,8 @@ describe('CustomStageFields', () => {
let wrapper = null;
const getSelectField = dropdownEl => dropdownEl.find(GlFormSelect);
const getLabelSelect = dropdownEl => dropdownEl.find(LabelsSelector);
const getSelectField = (dropdownEl) => dropdownEl.find(GlFormSelect);
const getLabelSelect = (dropdownEl) => dropdownEl.find(LabelsSelector);
const findName = () => wrapper.find('[data-testid="custom-stage-name"]');
const findStartEvent = () => wrapper.find('[data-testid="custom-stage-start-event"]');
......@@ -144,7 +144,7 @@ describe('CustomStageFields', () => {
});
describe('End event', () => {
const possibleEndEvents = endEvents.filter(ev =>
const possibleEndEvents = endEvents.filter((ev) =>
labelStartEvent.allowedEndEvents.includes(ev.identifier),
);
......
......@@ -71,14 +71,14 @@ describe('CustomStageForm', () => {
let wrapper = null;
let mock;
const findEvent = ev => wrapper.emitted()[ev];
const findEvent = (ev) => wrapper.emitted()[ev];
const findSubmitButton = () => wrapper.find('[data-testid="save-custom-stage"]');
const findCancelButton = () => wrapper.find('[data-testid="cancel-custom-stage"]');
const findRecoverStageDropdown = () =>
wrapper.find('[data-testid="recover-hidden-stage-dropdown"]');
const findFieldErrors = field => wrapper.vm.errors[field];
const findFieldErrors = (field) => wrapper.vm.errors[field];
const setFields = async (fields = minimumFields) => {
Object.entries(fields).forEach(([field, value]) => {
......
......@@ -59,10 +59,10 @@ function createComponent({
describe('DurationChart', () => {
let wrapper;
const findContainer = _wrapper => _wrapper.find('[data-testid="vsa-duration-chart"]');
const findScatterPlot = _wrapper => _wrapper.find(Scatterplot);
const findStageDropdown = _wrapper => _wrapper.find(StageDropdownFilter);
const findLoader = _wrapper => _wrapper.find(ChartSkeletonLoader);
const findContainer = (_wrapper) => _wrapper.find('[data-testid="vsa-duration-chart"]');
const findScatterPlot = (_wrapper) => _wrapper.find(Scatterplot);
const findStageDropdown = (_wrapper) => _wrapper.find(StageDropdownFilter);
const findLoader = (_wrapper) => _wrapper.find(ChartSkeletonLoader);
const selectStage = (_wrapper, index = 0) => {
findStageDropdown(_wrapper).findAll(GlDropdownItem).at(index).vm.$emit('click');
......
......@@ -75,7 +75,7 @@ describe('Filter bar', () => {
});
};
const createComponent = initialStore => {
const createComponent = (initialStore) => {
return shallowMount(FilterBar, {
localVue,
store: initialStore,
......@@ -101,10 +101,10 @@ describe('Filter bar', () => {
const selectedLabelList = [filterLabels[0]];
const findFilteredSearch = () => wrapper.find(FilteredSearchBar);
const getSearchToken = type =>
const getSearchToken = (type) =>
findFilteredSearch()
.props('tokens')
.find(token => token.type === type);
.find((token) => token.type === type);
describe('default', () => {
beforeEach(() => {
......
......@@ -10,10 +10,10 @@ import waitForPromises from 'helpers/wait_for_promises';
import { groupLabels } from '../mock_data';
const selectedLabel = groupLabels[groupLabels.length - 1];
const findActiveItem = wrapper =>
const findActiveItem = (wrapper) =>
wrapper
.findAll('gl-dropdown-item-stub')
.filter(d => d.attributes('active'))
.filter((d) => d.attributes('active'))
.at(0);
const findFlashError = () => document.querySelector('.flash-container .flash-text');
......@@ -66,7 +66,7 @@ describe('Value Stream Analytics LabelsSelector', () => {
expect(wrapper.html()).toMatchSnapshot();
});
it.each(labelNames)('generate a label item for the label %s', name => {
it.each(labelNames)('generate a label item for the label %s', (name) => {
expect(wrapper.text()).toContain(name);
});
......
......@@ -25,7 +25,7 @@ describe('Metrics', () => {
wrapper.destroy();
});
const findTimeMetricsAtIndex = index => wrapper.findAll(TimeMetricsCard).at(index);
const findTimeMetricsAtIndex = (index) => wrapper.findAll(TimeMetricsCard).at(index);
it.each`
metric | index | requestType
......
......@@ -6,7 +6,7 @@ import { transformedStagePathData, issueStage } from '../mock_data';
describe('PathNavigation', () => {
let wrapper = null;
const createComponent = props => {
const createComponent = (props) => {
return mount(Component, {
propsData: {
stages: transformedStagePathData,
......@@ -21,7 +21,7 @@ describe('PathNavigation', () => {
return wrapper.findAll('.gl-path-button');
};
const clickItemAt = index => {
const clickItemAt = (index) => {
pathNavigationItems().at(index).trigger('click');
};
......@@ -42,7 +42,7 @@ describe('PathNavigation', () => {
it('contains all the expected stages', () => {
const html = wrapper.find(GlPath).html();
transformedStagePathData.forEach(stage => {
transformedStagePathData.forEach((stage) => {
expect(html).toContain(stage.title);
});
});
......
......@@ -38,7 +38,7 @@ describe('StageDropdownFilter component', () => {
});
const findDropdown = () => wrapper.find(GlDropdown);
const selectDropdownItemAtIndex = index =>
const selectDropdownItemAtIndex = (index) =>
findDropdown().findAll(GlDropdownItem).at(index).vm.$emit('click');
describe('on stage click', () => {
......
......@@ -18,7 +18,7 @@ import {
codeEvents,
} from '../mock_data';
const generateEvents = n =>
const generateEvents = (n) =>
Array(n)
.fill(issueEvents[0])
.map((ev, k) => ({ ...ev, title: `event-${k}`, id: k }));
......
......@@ -29,7 +29,7 @@ describe('StageNavItem', () => {
const findStageTooltip = () => getBinding(findStageTitle().element, 'gl-tooltip');
const findStageMedian = () => wrapper.find({ ref: 'median' });
const findDropdown = () => wrapper.find({ ref: 'dropdown' });
const setFakeTitleWidth = value =>
const setFakeTitleWidth = (value) =>
Object.defineProperty(findStageTitle().element, 'scrollWidth', {
value,
});
......
......@@ -65,7 +65,7 @@ describe('StageTable', () => {
expect(renderedHeaders).toHaveLength(headers.length);
const headerText = wrapper.find($sel.headersList).text();
headers.forEach(title => {
headers.forEach((title) => {
expect(headerText).toContain(title);
});
});
......@@ -85,7 +85,7 @@ describe('StageTable', () => {
expect(evs).toHaveLength(allowedStages.length);
const nav = wrapper.find($sel.nav).html();
allowedStages.forEach(stage => {
allowedStages.forEach((stage) => {
expect(nav).toContain(stage.title);
});
});
......@@ -105,7 +105,7 @@ describe('StageTable', () => {
expect(evs).toHaveLength(issueEvents.length);
const evshtml = wrapper.find($sel.eventList).html();
issueEvents.forEach(ev => {
issueEvents.forEach((ev) => {
expect(evshtml).toContain(ev.title);
});
});
......@@ -128,7 +128,7 @@ describe('StageTable', () => {
it('will render the list of stages', () => {
const navEl = wrapper.find($sel.nav).element;
allowedStages.forEach(stage => {
allowedStages.forEach((stage) => {
expect(getByText(navEl, stage.title, { selector: 'li' })).not.toBe(null);
});
});
......
......@@ -18,9 +18,9 @@ import { groupLabels } from '../../mock_data';
const selectedLabelIds = [groupLabels[0].id];
const findSubjectFilters = ctx => ctx.find(GlSegmentedControl);
const findSelectedSubjectFilters = ctx => findSubjectFilters(ctx).attributes('checked');
const findDropdownLabels = ctx => ctx.find(LabelsSelector).findAll(GlDropdownItem);
const findSubjectFilters = (ctx) => ctx.find(GlSegmentedControl);
const findSelectedSubjectFilters = (ctx) => findSubjectFilters(ctx).attributes('checked');
const findDropdownLabels = (ctx) => ctx.find(LabelsSelector).findAll(GlDropdownItem);
const selectLabelAtIndex = (ctx, index) => {
findDropdownLabels(ctx).at(index).trigger('click');
......
......@@ -51,9 +51,9 @@ describe('TypeOfWorkCharts', () => {
let wrapper = null;
const findSubjectFilters = _wrapper => _wrapper.find(TasksByTypeFilters);
const findTasksByTypeChart = _wrapper => _wrapper.find(TasksByTypeChart);
const findLoader = _wrapper => _wrapper.find(ChartSkeletonLoader);
const findSubjectFilters = (_wrapper) => _wrapper.find(TasksByTypeFilters);
const findTasksByTypeChart = (_wrapper) => _wrapper.find(TasksByTypeChart);
const findLoader = (_wrapper) => _wrapper.find(ChartSkeletonLoader);
const selectedFilterText =
"Type of work Showing data for group 'Gitlab Org' from Dec 11, 2019 to Jan 10, 2020";
......
......@@ -52,10 +52,10 @@ describe('ValueStreamSelect', () => {
},
});
const findModal = modal => wrapper.find(`[data-testid="${modal}-value-stream-modal"]`);
const submitModal = modal => findModal(modal).vm.$emit('primary', mockEvent);
const findModal = (modal) => wrapper.find(`[data-testid="${modal}-value-stream-modal"]`);
const submitModal = (modal) => findModal(modal).vm.$emit('primary', mockEvent);
const findSelectValueStreamDropdown = () => wrapper.find(GlDropdown);
const findSelectValueStreamDropdownOptions = _wrapper => findDropdownItemText(_wrapper);
const findSelectValueStreamDropdownOptions = (_wrapper) => findDropdownItemText(_wrapper);
const findCreateValueStreamButton = () => wrapper.find(GlButton);
const findDeleteValueStreamButton = () => wrapper.find('[data-testid="delete-value-stream"]');
......@@ -82,7 +82,7 @@ describe('ValueStreamSelect', () => {
it('renders each value stream including a create button', () => {
const opts = findSelectValueStreamDropdownOptions(wrapper);
[...valueStreams.map(v => v.name), 'Create new Value Stream'].forEach(vs => {
[...valueStreams.map((v) => v.name), 'Create new Value Stream'].forEach((vs) => {
expect(opts).toContain(vs);
});
});
......
......@@ -19,10 +19,10 @@ export function renderTotalTime(selector, element, totalTime = {}) {
export const shouldFlashAMessage = (msg = '') =>
expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe(msg);
export const findDropdownItems = wrapper => wrapper.findAll(GlDropdownItem);
export const findDropdownItems = (wrapper) => wrapper.findAll(GlDropdownItem);
export const findDropdownItemText = wrapper =>
findDropdownItems(wrapper).wrappers.map(w => w.text());
export const findDropdownItemText = (wrapper) =>
findDropdownItems(wrapper).wrappers.map((w) => w.text());
export default {
renderTotalTime,
......
......@@ -18,8 +18,8 @@ import { getDateInPast, getDatesInRange } from '~/lib/utils/datetime_utility';
const fixtureEndpoints = {
customizableCycleAnalyticsStagesAndEvents: 'analytics/value_stream_analytics/stages.json', // customizable stages and events endpoint
stageEvents: stage => `analytics/value_stream_analytics/stages/${stage}/records.json`,
stageMedian: stage => `analytics/value_stream_analytics/stages/${stage}/median.json`,
stageEvents: (stage) => `analytics/value_stream_analytics/stages/${stage}/records.json`,
stageMedian: (stage) => `analytics/value_stream_analytics/stages/${stage}/median.json`,
recentActivityData: 'analytics/metrics/value_stream_analytics/summary.json',
timeMetricsData: 'analytics/metrics/value_stream_analytics/time_summary.json',
groupLabels: 'api/group_labels.json',
......@@ -58,7 +58,7 @@ export const group = {
export const currentGroup = convertObjectPropsToCamelCase(group, { deep: true });
const getStageByTitle = (stages, title) =>
stages.find(stage => stage.title && stage.title.toLowerCase().trim() === title) || {};
stages.find((stage) => stage.title && stage.title.toLowerCase().trim() === title) || {};
export const recentActivityData = getJSONFixture(fixtureEndpoints.recentActivityData);
export const timeMetricsData = getJSONFixture(fixtureEndpoints.timeMetricsData);
......@@ -81,7 +81,7 @@ export const stagingStage = getStageByTitle(dummyState.stages, 'staging');
export const allowedStages = [issueStage, planStage, codeStage];
const deepCamelCase = obj => convertObjectPropsToCamelCase(obj, { deep: true });
const deepCamelCase = (obj) => convertObjectPropsToCamelCase(obj, { deep: true });
export const defaultStages = ['issue', 'plan', 'review', 'code', 'test', 'staging'];
......@@ -135,24 +135,24 @@ export const medians = stageMedians;
export const rawCustomStageEvents = customizableStagesAndEvents.events;
export const camelCasedStageEvents = rawCustomStageEvents.map(deepCamelCase);
export const customStageLabelEvents = camelCasedStageEvents.filter(ev => ev.type === 'label');
export const customStageStartEvents = camelCasedStageEvents.filter(ev => ev.canBeStartEvent);
export const customStageLabelEvents = camelCasedStageEvents.filter((ev) => ev.type === 'label');
export const customStageStartEvents = camelCasedStageEvents.filter((ev) => ev.canBeStartEvent);
// get all the possible stop events
const allowedEndEventIds = new Set(customStageStartEvents.flatMap(e => e.allowedEndEvents));
export const customStageStopEvents = camelCasedStageEvents.filter(ev =>
const allowedEndEventIds = new Set(customStageStartEvents.flatMap((e) => e.allowedEndEvents));
export const customStageStopEvents = camelCasedStageEvents.filter((ev) =>
allowedEndEventIds.has(ev.identifier),
);
export const customStageEvents = uniq(
[...customStageStartEvents, ...customStageStopEvents],
false,
ev => ev.identifier,
(ev) => ev.identifier,
);
export const labelStartEvent = customStageLabelEvents[0];
export const labelStopEvent = customStageLabelEvents.find(
ev => ev.identifier === labelStartEvent.allowedEndEvents[0],
(ev) => ev.identifier === labelStartEvent.allowedEndEvents[0],
);
export const rawCustomStageFormErrors = {
......@@ -166,10 +166,10 @@ const dateRange = getDatesInRange(startDate, endDate, toYmd);
export const apiTasksByTypeData = getJSONFixture(
'analytics/charts/type_of_work/tasks_by_type.json',
).map(labelData => {
).map((labelData) => {
// add data points for our mock date range
const maxValue = 10;
const series = dateRange.map(date => [date, Math.floor(Math.random() * Math.floor(maxValue))]);
const series = dateRange.map((date) => [date, Math.floor(Math.random() * Math.floor(maxValue))]);
return {
...labelData,
series,
......
......@@ -80,7 +80,7 @@ describe('Value Stream Analytics getters', () => {
});
describe('without a currentGroup set', () => {
it.each([[''], [{}], [null]])('given "%s" will return null', value => {
it.each([[''], [{}], [null]])('given "%s" will return null', (value) => {
state = { currentGroup: value };
expect(getters.currentGroupPath(state)).toEqual(null);
});
......
......@@ -130,7 +130,7 @@ describe('Value Stream Analytics mutations', () => {
});
it('will convert the stats object to stages', () => {
[issueStage, planStage, codeStage, stagingStage, reviewStage].forEach(stage => {
[issueStage, planStage, codeStage, stagingStage, reviewStage].forEach((stage) => {
expect(state.stages).toContainEqual(stage);
});
});
......
......@@ -39,7 +39,7 @@ import {
timeMetricsData,
} from './mock_data';
const labelEventIds = labelEvents.map(ev => ev.identifier);
const labelEventIds = labelEvents.map((ev) => ev.identifier);
describe('Value Stream Analytics utils', () => {
describe('isStartEvent', () => {
......@@ -49,7 +49,7 @@ describe('Value Stream Analytics utils', () => {
it('will return false for input that is not a start event', () => {
[{ identifier: 'fake-event', canBeStartEvent: false }, {}, [], null, undefined].forEach(
ev => {
(ev) => {
expect(isStartEvent(ev)).toEqual(false);
},
);
......@@ -62,7 +62,7 @@ describe('Value Stream Analytics utils', () => {
});
it('will return false if the given event identifier is not in the labelEvents array', () => {
[startEvents[1].identifier, null, undefined, ''].forEach(ev => {
[startEvents[1].identifier, null, undefined, ''].forEach((ev) => {
expect(isLabelEvent(labelEventIds, ev)).toEqual(false);
});
expect(isLabelEvent(labelEventIds)).toEqual(false);
......@@ -71,20 +71,20 @@ describe('Value Stream Analytics utils', () => {
describe('eventToOption', () => {
it('will return null if no valid object is passed in', () => {
[{}, [], null, undefined].forEach(i => {
[{}, [], null, undefined].forEach((i) => {
expect(eventToOption(i)).toEqual(null);
});
});
it('will set the "value" property to the events identifier', () => {
events.forEach(ev => {
events.forEach((ev) => {
const res = eventToOption(ev);
expect(res.value).toEqual(ev.identifier);
});
});
it('will set the "text" property to the events name', () => {
events.forEach(ev => {
events.forEach((ev) => {
const res = eventToOption(ev);
expect(res.text).toEqual(ev.name);
});
......@@ -111,7 +111,7 @@ describe('Value Stream Analytics utils', () => {
});
it('will return an empty array if there are no end events available', () => {
['cool_issue_label_added', [], {}, null, undefined].forEach(ev => {
['cool_issue_label_added', [], {}, null, undefined].forEach((ev) => {
expect(getAllowedEndEvents(events, ev)).toEqual([]);
});
});
......@@ -123,7 +123,7 @@ describe('Value Stream Analytics utils', () => {
});
it('will return an empty array if there are no matching events', () => {
[['lol', 'bad'], [], {}, null, undefined].forEach(items => {
[['lol', 'bad'], [], {}, null, undefined].forEach((items) => {
expect(eventsByIdentifier(events, items)).toEqual([]);
});
expect(eventsByIdentifier([], labelEvents)).toEqual([]);
......@@ -162,14 +162,14 @@ describe('Value Stream Analytics utils', () => {
it('sets the slug to the value of the stage id', () => {
const transformed = transformRawStages([issueStage, rawCustomStage]);
transformed.forEach(t => {
transformed.forEach((t) => {
expect(t.slug).toEqual(t.id);
});
});
it('sets the name to the value of the stage title if its not set', () => {
const transformed = transformRawStages([issueStage, rawCustomStage]);
transformed.forEach(t => {
transformed.forEach((t) => {
expect(t.name.length > 0).toBe(true);
expect(t.name).toEqual(t.title);
});
......@@ -204,7 +204,7 @@ describe('Value Stream Analytics utils', () => {
it('extracts the value from an array of datetime / value pairs', () => {
expect(transformedDummySeries.every(isNumber)).toEqual(true);
Object.values(dummySeries).forEach(v => {
Object.values(dummySeries).forEach((v) => {
expect(transformedDummySeries.includes(v)).toBeTruthy();
});
});
......@@ -232,21 +232,21 @@ describe('Value Stream Analytics utils', () => {
const extractSeriesValues = ({ label: { title: name }, series }) => {
return {
name,
data: series.map(kv => kv[1]),
data: series.map((kv) => kv[1]),
};
};
const data = rawTasksByTypeData.map(extractSeriesValues);
const labels = rawTasksByTypeData.map(d => {
const labels = rawTasksByTypeData.map((d) => {
const { label } = d;
return label.title;
});
it('will return blank arrays if given no data', () => {
[{ data: [], startDate, endDate }, [], {}].forEach(chartData => {
[{ data: [], startDate, endDate }, [], {}].forEach((chartData) => {
transformed = getTasksByTypeData(chartData);
['data', 'groupBy'].forEach(key => {
['data', 'groupBy'].forEach((key) => {
expect(transformed[key]).toEqual([]);
});
});
......@@ -258,7 +258,7 @@ describe('Value Stream Analytics utils', () => {
});
it('will return an object with the properties needed for the chart', () => {
['data', 'groupBy'].forEach(key => {
['data', 'groupBy'].forEach((key) => {
expect(transformed).toHaveProperty(key);
});
});
......@@ -287,7 +287,7 @@ describe('Value Stream Analytics utils', () => {
});
it('contains a value for each day in the groupBy', () => {
transformed.data.forEach(d => {
transformed.data.forEach((d) => {
expect(d.data).toHaveLength(transformed.groupBy.length);
});
});
......@@ -326,13 +326,13 @@ describe('Value Stream Analytics utils', () => {
});
it('selects the correct stage', () => {
const selected = response.filter(stage => stage.selected === true)[0];
const selected = response.filter((stage) => stage.selected === true)[0];
expect(selected.title).toEqual(issueStage.title);
});
it('includes the correct metric for the associated stage', () => {
const issue = response.filter(stage => stage.name === 'Issue')[0];
const issue = response.filter((stage) => stage.name === 'Issue')[0];
expect(issue.metric).toEqual(pathNavIssueMetric);
});
......
......@@ -125,10 +125,10 @@ describe('Filter bar', () => {
});
const findFilteredSearch = () => wrapper.find(FilteredSearchBar);
const getSearchToken = type =>
const getSearchToken = (type) =>
findFilteredSearch()
.props('tokens')
.find(token => token.type === type);
.find((token) => token.type === type);
describe('default', () => {
beforeEach(() => {
......
......@@ -57,7 +57,7 @@ describe('ThroughputTable', () => {
expect(wrapper.find(component).exists()).toBe(visible);
};
const additionalData = data => {
const additionalData = (data) => {
wrapper.setData({
throughputTableData: {
list: [{ ...throughputTableData[0], ...data }],
......@@ -68,7 +68,7 @@ describe('ThroughputTable', () => {
const findTable = () => wrapper.find(GlTable);
const findCol = testId => findTable().find(`[data-testid="${testId}"]`);
const findCol = (testId) => findTable().find(`[data-testid="${testId}"]`);
const findColSubItem = (colTestId, childTetestId) =>
findCol(colTestId).find(`[data-testid="${childTetestId}"]`);
......
......@@ -570,7 +570,7 @@ describe('ProductivityApp component', () => {
milestone_title: null,
};
const shouldSetUrlParams = result => {
const shouldSetUrlParams = (result) => {
expect(urlUtils.setUrlParams).toHaveBeenCalledWith(result, window.location.href, true);
expect(commonUtils.historyPushState).toHaveBeenCalled();
};
......
......@@ -3,7 +3,7 @@ import filterState from 'ee/analytics/productivity_analytics/store/modules/filte
import tableState from 'ee/analytics/productivity_analytics/store/modules/table/state';
import state from 'ee/analytics/productivity_analytics/store/state';
const resetStore = store => {
const resetStore = (store) => {
const newState = {
...state(),
filters: filterState(),
......
......@@ -5,7 +5,7 @@ import testAction from 'helpers/vuex_action_helper';
describe('Productivity analytics actions', () => {
describe('setEndpoint', () => {
it('commits the SET_ENDPOINT mutation', done =>
it('commits the SET_ENDPOINT mutation', (done) =>
testAction(
actions.setEndpoint,
'endpoint.json',
......
......@@ -72,7 +72,7 @@ describe('Productivity analytics chart actions', () => {
expect(axios.get).toHaveBeenCalledWith(mockedState.endpoint, { params: globalParams });
});
it('dispatches success with received data', done =>
it('dispatches success with received data', (done) =>
testAction(
actions.fetchChartData,
chartKey,
......@@ -94,7 +94,7 @@ describe('Productivity analytics chart actions', () => {
mock.onGet(mockedState.endpoint).replyOnce(200, mockScatterplotData);
});
it('dispatches success with received data and transformedData', done => {
it('dispatches success with received data and transformedData', (done) => {
testAction(
actions.fetchChartData,
chartKeys.scatterplot,
......@@ -122,7 +122,7 @@ describe('Productivity analytics chart actions', () => {
mock.onGet(mockedState.endpoint).replyOnce(500);
});
it('dispatches error', done => {
it('dispatches error', (done) => {
testAction(
actions.fetchChartData,
chartKey,
......@@ -149,7 +149,7 @@ describe('Productivity analytics chart actions', () => {
});
describe('requestChartData', () => {
it('should commit the request mutation', done => {
it('should commit the request mutation', (done) => {
testAction(
actions.requestChartData,
chartKey,
......@@ -167,7 +167,7 @@ describe('Productivity analytics chart actions', () => {
mockedState.charts[disabledChartKey].enabled = false;
});
it('does not dispatch the requestChartData action', done => {
it('does not dispatch the requestChartData action', (done) => {
testAction(actions.fetchChartData, disabledChartKey, mockedState, [], [], done);
});
......@@ -180,7 +180,7 @@ describe('Productivity analytics chart actions', () => {
});
describe('receiveChartDataSuccess', () => {
it('should commit received data', done => {
it('should commit received data', (done) => {
testAction(
actions.receiveChartDataSuccess,
{ chartKey, data: mockHistogramData },
......@@ -198,7 +198,7 @@ describe('Productivity analytics chart actions', () => {
});
describe('receiveChartDataError', () => {
it('should commit error', done => {
it('should commit error', (done) => {
const error = { response: { status: 500 } };
testAction(
actions.receiveChartDataError,
......@@ -220,7 +220,7 @@ describe('Productivity analytics chart actions', () => {
});
describe('fetchSecondaryChartData', () => {
it('dispatches fetchChartData for all chart types except for the main chart', done => {
it('dispatches fetchChartData for all chart types except for the main chart', (done) => {
testAction(
actions.fetchSecondaryChartData,
null,
......@@ -239,7 +239,7 @@ describe('Productivity analytics chart actions', () => {
describe('setMetricType', () => {
const metricType = 'time_to_merge';
it('should commit metricType', done => {
it('should commit metricType', (done) => {
testAction(
actions.setMetricType,
{ chartKey, metricType },
......@@ -252,7 +252,7 @@ describe('Productivity analytics chart actions', () => {
});
describe('updateSelectedItems', () => {
it('should commit selected chart item and dispatch fetchSecondaryChartData and setPage', done => {
it('should commit selected chart item and dispatch fetchSecondaryChartData and setPage', (done) => {
testAction(
actions.updateSelectedItems,
{ chartKey, item: 5 },
......@@ -266,7 +266,7 @@ describe('Productivity analytics chart actions', () => {
describe('resetMainChartSelection', () => {
describe('when skipReload is false (by default)', () => {
it('should commit selected chart item and dispatch fetchSecondaryChartData and setPage', done => {
it('should commit selected chart item and dispatch fetchSecondaryChartData and setPage', (done) => {
testAction(
actions.resetMainChartSelection,
null,
......@@ -279,7 +279,7 @@ describe('Productivity analytics chart actions', () => {
});
describe('when skipReload is true', () => {
it('should commit selected chart and it should not dispatch any further actions', done => {
it('should commit selected chart and it should not dispatch any further actions', (done) => {
testAction(
actions.resetMainChartSelection,
true,
......@@ -298,7 +298,7 @@ describe('Productivity analytics chart actions', () => {
});
describe('setChartEnabled', () => {
it('should commit enabled state', done => {
it('should commit enabled state', (done) => {
testAction(
actions.setChartEnabled,
{ chartKey: chartKeys.scatterplot, isEnabled: false },
......
......@@ -255,7 +255,7 @@ describe('Productivity analytics chart getters', () => {
expect(getters.scatterplotYaxisLabel(null, mockGetters, mockRootState)).toBe('Days');
});
it.each(metricsInHours)('returns "Hours" for the "%s" metric', metric => {
it.each(metricsInHours)('returns "Hours" for the "%s" metric', (metric) => {
const mockGetters = {
getSelectedMetric: () => metric,
};
......
......@@ -30,7 +30,7 @@ describe('Productivity analytics filter actions', () => {
});
describe('setInitialData', () => {
it('commits the SET_INITIAL_DATA mutation and fetches data by default', done => {
it('commits the SET_INITIAL_DATA mutation and fetches data by default', (done) => {
actions
.setInitialData(store, { data: initialData })
.then(() => {
......@@ -54,7 +54,7 @@ describe('Productivity analytics filter actions', () => {
.catch(done.fail);
});
it("commits the SET_INITIAL_DATA mutation and doesn't fetch data when skipFetch=true", done =>
it("commits the SET_INITIAL_DATA mutation and doesn't fetch data when skipFetch=true", (done) =>
testAction(
actions.setInitialData,
{ skipFetch: true, data: initialData },
......@@ -71,7 +71,7 @@ describe('Productivity analytics filter actions', () => {
});
describe('setGroupNamespace', () => {
it('commits the SET_GROUP_NAMESPACE mutation', done => {
it('commits the SET_GROUP_NAMESPACE mutation', (done) => {
actions
.setGroupNamespace(store, groupNamespace)
.then(() => {
......@@ -103,7 +103,7 @@ describe('Productivity analytics filter actions', () => {
});
describe('setProjectPath', () => {
it('commits the SET_PROJECT_PATH mutation', done => {
it('commits the SET_PROJECT_PATH mutation', (done) => {
actions
.setProjectPath(store, projectPath)
.then(() => {
......@@ -135,7 +135,7 @@ describe('Productivity analytics filter actions', () => {
});
describe('setFilters', () => {
it('commits the SET_FILTERS mutation', done => {
it('commits the SET_FILTERS mutation', (done) => {
actions
.setFilters(store, { author_username: 'root' })
.then(() => {
......@@ -167,7 +167,7 @@ describe('Productivity analytics filter actions', () => {
});
describe('setDateRange', () => {
it('commits the SET_DATE_RANGE mutation', done => {
it('commits the SET_DATE_RANGE mutation', (done) => {
actions
.setDateRange(store, { startDate, endDate })
.then(() => {
......
......@@ -104,7 +104,7 @@ describe('Productivity analytics table actions', () => {
});
});
it('dispatches success with received data', done =>
it('dispatches success with received data', (done) =>
testAction(
actions.fetchMergeRequests,
null,
......@@ -126,7 +126,7 @@ describe('Productivity analytics table actions', () => {
mock.onGet(mockedState.endpoint).replyOnce(500);
});
it('dispatches error', done => {
it('dispatches error', (done) => {
testAction(
actions.fetchMergeRequests,
null,
......@@ -146,7 +146,7 @@ describe('Productivity analytics table actions', () => {
});
describe('requestMergeRequests', () => {
it('should commit the request mutation', done =>
it('should commit the request mutation', (done) =>
testAction(
actions.requestMergeRequests,
null,
......@@ -158,7 +158,7 @@ describe('Productivity analytics table actions', () => {
});
describe('receiveMergeRequestsSuccess', () => {
it('should commit received data', done =>
it('should commit received data', (done) =>
testAction(
actions.receiveMergeRequestsSuccess,
{ headers, data: mockMergeRequests },
......@@ -175,7 +175,7 @@ describe('Productivity analytics table actions', () => {
});
describe('receiveMergeRequestsError', () => {
it('should commit error', done =>
it('should commit error', (done) =>
testAction(
actions.receiveMergeRequestsError,
{ response: { status: 500 } },
......@@ -187,7 +187,7 @@ describe('Productivity analytics table actions', () => {
});
describe('setSortField', () => {
it('should commit setSortField', done =>
it('should commit setSortField', (done) =>
testAction(
actions.setSortField,
'time_to_last_commit',
......@@ -200,7 +200,7 @@ describe('Productivity analytics table actions', () => {
done,
));
it('should not dispatch setColumnMetric when metric is "days_to_merge"', done =>
it('should not dispatch setColumnMetric when metric is "days_to_merge"', (done) =>
testAction(
actions.setSortField,
'days_to_merge',
......@@ -212,7 +212,7 @@ describe('Productivity analytics table actions', () => {
});
describe('toggleSortOrder', () => {
it('should commit toggleSortOrder', done =>
it('should commit toggleSortOrder', (done) =>
testAction(
actions.toggleSortOrder,
null,
......@@ -224,7 +224,7 @@ describe('Productivity analytics table actions', () => {
});
describe('setColumnMetric', () => {
it('should commit setColumnMetric', done =>
it('should commit setColumnMetric', (done) =>
testAction(
actions.setColumnMetric,
'time_to_first_comment',
......@@ -236,7 +236,7 @@ describe('Productivity analytics table actions', () => {
});
describe('setPage', () => {
it('should commit setPage', done =>
it('should commit setPage', (done) =>
testAction(
actions.setPage,
2,
......
......@@ -14,9 +14,9 @@ describe('Select projects dropdown component', () => {
let wrapper;
const findSelectAllProjects = () => wrapper.find('[data-testid="select-all-projects"]');
const findProjectById = id => wrapper.find(`[data-testid="select-project-${id}"]`);
const findProjectById = (id) => wrapper.find(`[data-testid="select-project-${id}"]`);
const selectAllProjects = () => findSelectAllProjects().trigger('click');
const selectProjectById = id => findProjectById(id).trigger('click');
const selectProjectById = (id) => findProjectById(id).trigger('click');
const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
......
......@@ -18,10 +18,10 @@ describe('Test coverage table component', () => {
const findLoadingState = () => wrapper.find('[data-testid="test-coverage-loading-state"');
const findTable = () => wrapper.find('[data-testid="test-coverage-data-table"');
const findTableRows = () => findTable().findAll('tbody tr');
const findProjectNameById = id => wrapper.find(`[data-testid="${id}-name"`);
const findProjectAverageById = id => wrapper.find(`[data-testid="${id}-average"`);
const findProjectCountById = id => wrapper.find(`[data-testid="${id}-count"`);
const findProjectDateById = id => wrapper.find(`[data-testid="${id}-date"`);
const findProjectNameById = (id) => wrapper.find(`[data-testid="${id}-name"`);
const findProjectAverageById = (id) => wrapper.find(`[data-testid="${id}-average"`);
const findProjectCountById = (id) => wrapper.find(`[data-testid="${id}-count"`);
const findProjectDateById = (id) => wrapper.find(`[data-testid="${id}-date"`);
const createComponent = ({ data = {}, mountFn = shallowMount } = {}) => {
wrapper = mountFn(TestCoverageTable, {
......
......@@ -192,7 +192,7 @@ describe('buildCycleAnalyticsInitialData', () => {
});
it('with no search term returns the data', () => {
['', null].forEach(search => {
['', null].forEach((search) => {
expect(filterBySearchTerm(data, search)).toEqual(data);
});
});
......
......@@ -42,7 +42,7 @@ describe('Api', () => {
});
describe('ldapGroups', () => {
it('calls callback on completion', done => {
it('calls callback on completion', (done) => {
const query = 'query';
const provider = 'provider';
const callback = jest.fn();
......@@ -55,7 +55,7 @@ describe('Api', () => {
]);
Api.ldapGroups(query, provider, callback)
.then(response => {
.then((response) => {
expect(callback).toHaveBeenCalledWith(response);
})
.then(done)
......@@ -64,7 +64,7 @@ describe('Api', () => {
});
describe('createChildEpic', () => {
it('calls `axios.post` using params `groupId`, `parentEpicIid` and title', done => {
it('calls `axios.post` using params `groupId`, `parentEpicIid` and title', (done) => {
const groupId = 'gitlab-org';
const parentEpicId = 1;
const title = 'Sample epic';
......@@ -89,7 +89,7 @@ describe('Api', () => {
});
describe('groupEpics', () => {
it('calls `axios.get` using param `groupId`', done => {
it('calls `axios.get` using param `groupId`', (done) => {
const groupId = 2;
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/epics`;
......@@ -115,7 +115,7 @@ describe('Api', () => {
.catch(done.fail);
});
it('calls `axios.get` using param `search` when it is provided', done => {
it('calls `axios.get` using param `search` when it is provided', (done) => {
const groupId = 2;
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/epics`;
......@@ -144,7 +144,7 @@ describe('Api', () => {
});
describe('addEpicIssue', () => {
it('calls `axios.post` using params `groupId`, `epicIid` and `issueId`', done => {
it('calls `axios.post` using params `groupId`, `epicIid` and `issueId`', (done) => {
const groupId = 2;
const mockIssue = {
id: 20,
......@@ -170,7 +170,7 @@ describe('Api', () => {
});
describe('removeEpicIssue', () => {
it('calls `axios.delete` using params `groupId`, `epicIid` and `epicIssueId`', done => {
it('calls `axios.delete` using params `groupId`, `epicIid` and `epicIssueId`', (done) => {
const groupId = 2;
const mockIssue = {
id: 20,
......@@ -227,7 +227,7 @@ describe('Api', () => {
};
describe('cycleAnalyticsTasksByType', () => {
it('fetches tasks by type data', done => {
it('fetches tasks by type data', (done) => {
const tasksByTypeResponse = [
{
label: {
......@@ -266,7 +266,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsTopLabels', () => {
it('fetches top group level labels', done => {
it('fetches top group level labels', (done) => {
const response = [];
const labelIds = [10, 9, 8, 7];
const params = {
......@@ -291,7 +291,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsSummaryData', () => {
it('fetches value stream analytics summary data', done => {
it('fetches value stream analytics summary data', (done) => {
const response = [
{ value: 0, title: 'New Issues' },
{ value: 0, title: 'Deploys' },
......@@ -301,7 +301,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsSummaryData(groupId, params)
.then(responseObj =>
.then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, {
response,
params,
......@@ -314,7 +314,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsTimeSummaryData', () => {
it('fetches value stream analytics summary data', done => {
it('fetches value stream analytics summary data', (done) => {
const response = [
{ value: '10.0', title: 'Lead time', unit: 'per day' },
{ value: '2.0', title: 'Cycle Time', unit: 'per day' },
......@@ -325,7 +325,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsTimeSummaryData(groupId, params)
.then(responseObj =>
.then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, {
response,
params,
......@@ -338,13 +338,13 @@ describe('Api', () => {
});
describe('cycleAnalyticsValueStreams', () => {
it('fetches custom value streams', done => {
it('fetches custom value streams', (done) => {
const response = [{ name: 'value stream 1', id: 1 }];
const expectedUrl = valueStreamBaseUrl({ resource: 'value_streams' });
mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsValueStreams(groupId)
.then(responseObj =>
.then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, {
response,
expectedUrl,
......@@ -356,7 +356,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsCreateValueStream', () => {
it('submit the custom value stream data', done => {
it('submit the custom value stream data', (done) => {
const response = {};
const customValueStream = { name: 'cool-value-stream-stage' };
const expectedUrl = valueStreamBaseUrl({ resource: 'value_streams' });
......@@ -374,7 +374,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsDeleteValueStream', () => {
it('delete the custom value stream', done => {
it('delete the custom value stream', (done) => {
const response = {};
const expectedUrl = valueStreamBaseUrl({ resource: `value_streams/${valueStreamId}` });
mock.onDelete(expectedUrl).reply(httpStatus.OK, response);
......@@ -390,7 +390,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsGroupStagesAndEvents', () => {
it('fetches custom stage events and all stages', done => {
it('fetches custom stage events and all stages', (done) => {
const response = { events: [], stages: [] };
const params = {
group_id: groupId,
......@@ -401,7 +401,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsGroupStagesAndEvents({ groupId, valueStreamId, params })
.then(responseObj =>
.then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, {
response,
params,
......@@ -414,7 +414,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsStageEvents', () => {
it('fetches stage events', done => {
it('fetches stage events', (done) => {
const response = { events: [] };
const params = { ...defaultParams };
const expectedUrl = valueStreamBaseUrl({
......@@ -424,7 +424,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsStageEvents({ groupId, valueStreamId, stageId, params })
.then(responseObj =>
.then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, {
response,
params,
......@@ -437,7 +437,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsStageMedian', () => {
it('fetches stage events', done => {
it('fetches stage events', (done) => {
const response = { value: '5 days ago' };
const params = { ...defaultParams };
const expectedUrl = valueStreamBaseUrl({
......@@ -447,7 +447,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsStageMedian({ groupId, valueStreamId, stageId, params })
.then(responseObj =>
.then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, {
response,
params,
......@@ -460,7 +460,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsCreateStage', () => {
it('submit the custom stage data', done => {
it('submit the custom stage data', (done) => {
const response = {};
const customStage = {
name: 'cool-stage',
......@@ -488,7 +488,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsUpdateStage', () => {
it('updates the stage data', done => {
it('updates the stage data', (done) => {
const response = { id: stageId, custom: false, hidden: true, name: 'nice-stage' };
const stageData = { name: 'nice-stage', hidden: true };
const expectedUrl = valueStreamBaseUrl({
......@@ -509,7 +509,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsRemoveStage', () => {
it('deletes the specified data', done => {
it('deletes the specified data', (done) => {
const response = { id: stageId, hidden: true, custom: true };
const expectedUrl = valueStreamBaseUrl({
id: valueStreamId,
......@@ -529,7 +529,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsDurationChart', () => {
it('fetches stage duration data', done => {
it('fetches stage duration data', (done) => {
const response = [];
const params = { ...defaultParams };
const expectedUrl = valueStreamBaseUrl({
......@@ -539,7 +539,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsDurationChart({ groupId, valueStreamId, stageId, params })
.then(responseObj =>
.then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, {
response,
params,
......@@ -552,7 +552,7 @@ describe('Api', () => {
});
describe('cycleAnalyticsGroupLabels', () => {
it('fetches group level labels', done => {
it('fetches group level labels', (done) => {
const response = [];
const expectedUrl = `${dummyUrlRoot}/groups/${groupId}/-/labels.json`;
......
......@@ -17,7 +17,7 @@ describe('Approval Check Popover', () => {
describe('with a documentation link', () => {
const documentationLink = `${TEST_HOST}/documentation`;
beforeEach(done => {
beforeEach((done) => {
wrapper.setProps({
documentationLink,
});
......
......@@ -20,20 +20,20 @@ describe('Approval Check Popover', () => {
describe('computed props', () => {
const securityApprovalsHelpPagePath = `${TEST_HOST}/documentation`;
beforeEach(done => {
beforeEach((done) => {
wrapper.setProps({ securityApprovalsHelpPagePath });
Vue.nextTick(done);
});
describe('showVulnerabilityCheckPopover', () => {
it('return true if the rule type is "Vulnerability-Check"', done => {
it('return true if the rule type is "Vulnerability-Check"', (done) => {
wrapper.setProps({ rule: { name: VULNERABILITY_CHECK_NAME } });
Vue.nextTick(() => {
expect(wrapper.vm.showVulnerabilityCheckPopover).toBe(true);
done();
});
});
it('return false if the rule type is "Vulnerability-Check"', done => {
it('return false if the rule type is "Vulnerability-Check"', (done) => {
wrapper.setProps({ rule: { name: 'FooRule' } });
Vue.nextTick(() => {
expect(wrapper.vm.showVulnerabilityCheckPopover).toBe(false);
......@@ -43,14 +43,14 @@ describe('Approval Check Popover', () => {
});
describe('showLicenseCheckPopover', () => {
it('return true if the rule type is "License-Check"', done => {
it('return true if the rule type is "License-Check"', (done) => {
wrapper.setProps({ rule: { name: LICENSE_CHECK_NAME } });
Vue.nextTick(() => {
expect(wrapper.vm.showLicenseCheckPopover).toBe(true);
done();
});
});
it('return false if the rule type is "License-Check"', done => {
it('return false if the rule type is "License-Check"', (done) => {
wrapper.setProps({ rule: { name: 'FooRule' } });
Vue.nextTick(() => {
expect(wrapper.vm.showLicenseCheckPopover).toBe(false);
......@@ -60,7 +60,7 @@ describe('Approval Check Popover', () => {
});
describe('approvalConfig', () => {
it('returns "Vulberability-Check" config', done => {
it('returns "Vulberability-Check" config', (done) => {
wrapper.setProps({ rule: { name: VULNERABILITY_CHECK_NAME } });
Vue.nextTick(() => {
expect(wrapper.vm.approvalRuleConfig.title).toBe(
......@@ -75,7 +75,7 @@ describe('Approval Check Popover', () => {
done();
});
});
it('returns "License-Check" config', done => {
it('returns "License-Check" config', (done) => {
wrapper.setProps({ rule: { name: LICENSE_CHECK_NAME } });
Vue.nextTick(() => {
expect(wrapper.vm.approvalRuleConfig.title).toBe(
......@@ -90,7 +90,7 @@ describe('Approval Check Popover', () => {
done();
});
});
it('returns an undefined config', done => {
it('returns an undefined config', (done) => {
wrapper.setProps({ rule: { name: 'FooRule' } });
Vue.nextTick(() => {
expect(wrapper.vm.approvalConfig).toBe(undefined);
......@@ -100,21 +100,21 @@ describe('Approval Check Popover', () => {
});
describe('documentationLink', () => {
it('returns documentation link for "License-Check"', done => {
it('returns documentation link for "License-Check"', (done) => {
wrapper.setProps({ rule: { name: 'License-Check' } });
Vue.nextTick(() => {
expect(wrapper.vm.documentationLink).toBe(securityApprovalsHelpPagePath);
done();
});
});
it('returns documentation link for "Vulnerability-Check"', done => {
it('returns documentation link for "Vulnerability-Check"', (done) => {
wrapper.setProps({ rule: { name: 'Vulnerability-Check' } });
Vue.nextTick(() => {
expect(wrapper.vm.documentationLink).toBe(securityApprovalsHelpPagePath);
done();
});
});
it('returns empty text', done => {
it('returns empty text', (done) => {
const text = '';
wrapper.setProps({ rule: { name: 'FooRule' } });
Vue.nextTick(() => {
......
......@@ -26,13 +26,13 @@ const TEST_USERS = [
const localVue = createLocalVue();
const waitForEvent = ($input, event) => new Promise(resolve => $input.one(event, resolve));
const parseAvatar = element =>
const waitForEvent = ($input, event) => new Promise((resolve) => $input.one(event, resolve));
const parseAvatar = (element) =>
element.classList.contains('identicon') ? null : element.getAttribute('src');
const select2Container = () => document.querySelector('.select2-container');
const select2DropdownOptions = () => document.querySelectorAll('#select2-drop .user-result');
const select2DropdownItems = () =>
Array.prototype.map.call(select2DropdownOptions(), element => {
Array.prototype.map.call(select2DropdownOptions(), (element) => {
const isGroup = element.classList.contains('group-result');
const avatar = parseAvatar(element.querySelector('.avatar'));
......@@ -92,7 +92,7 @@ describe('Approvals ApproversSelect', () => {
expect(select2Container()).not.toBe(null);
});
it('queries and displays groups and users', async done => {
it('queries and displays groups and users', async (done) => {
await factory();
const expected = TEST_GROUPS.concat(TEST_USERS)
......@@ -114,7 +114,7 @@ describe('Approvals ApproversSelect', () => {
describe('with search term', () => {
const term = 'lorem';
beforeEach(async done => {
beforeEach(async (done) => {
await factory();
waitForEvent($input, 'select2-loaded')
......@@ -140,7 +140,7 @@ describe('Approvals ApproversSelect', () => {
const skipGroupIds = [7, 8];
const skipUserIds = [9, 10];
beforeEach(async done => {
beforeEach(async (done) => {
await factory({
propsData: {
skipGroupIds,
......@@ -170,7 +170,7 @@ describe('Approvals ApproversSelect', () => {
});
});
it('emits input when data changes', async done => {
it('emits input when data changes', async (done) => {
await factory();
const expectedFinal = [
......
......@@ -12,11 +12,11 @@ const TEST_PROTECTED_BRANCHES = [
{ id: 2, name: 'development' },
];
const TEST_BRANCHES_SELECTIONS = [TEST_DEFAULT_BRANCH, ...TEST_PROTECTED_BRANCHES];
const waitForEvent = ($input, event) => new Promise(resolve => $input.one(event, resolve));
const waitForEvent = ($input, event) => new Promise((resolve) => $input.one(event, resolve));
const select2Container = () => document.querySelector('.select2-container');
const select2DropdownOptions = () => document.querySelectorAll('.result-name');
const branchNames = () => TEST_BRANCHES_SELECTIONS.map(branch => branch.name);
const protectedBranchNames = () => TEST_PROTECTED_BRANCHES.map(branch => branch.name);
const branchNames = () => TEST_BRANCHES_SELECTIONS.map((branch) => branch.name);
const protectedBranchNames = () => TEST_PROTECTED_BRANCHES.map((branch) => branch.name);
const localVue = createLocalVue();
localVue.use(Vuex);
......@@ -64,12 +64,12 @@ describe('Branches Select', () => {
expect(select2Container()).not.toBe(null);
});
it('displays all the protected branches and any branch', async done => {
it('displays all the protected branches and any branch', async (done) => {
await createComponent();
waitForEvent($input, 'select2-loaded')
.then(() => {
const nodeList = select2DropdownOptions();
const names = [...nodeList].map(el => el.textContent);
const names = [...nodeList].map((el) => el.textContent);
expect(names).toEqual(branchNames());
})
......@@ -83,7 +83,7 @@ describe('Branches Select', () => {
return createComponent();
});
it('fetches protected branches with search term', done => {
it('fetches protected branches with search term', (done) => {
const term = 'lorem';
waitForEvent($input, 'select2-loaded')
.then(() => {})
......@@ -95,11 +95,11 @@ describe('Branches Select', () => {
expect(Api.projectProtectedBranches).toHaveBeenCalledWith(TEST_PROJECT_ID, term);
});
it('fetches protected branches with no any branch if there is search', done => {
it('fetches protected branches with no any branch if there is search', (done) => {
waitForEvent($input, 'select2-loaded')
.then(() => {
const nodeList = select2DropdownOptions();
const names = [...nodeList].map(el => el.textContent);
const names = [...nodeList].map((el) => el.textContent);
expect(names).toEqual(protectedBranchNames());
})
......@@ -108,11 +108,11 @@ describe('Branches Select', () => {
search('master');
});
it('fetches protected branches with any branch if search contains term "any"', done => {
it('fetches protected branches with any branch if search contains term "any"', (done) => {
waitForEvent($input, 'select2-loaded')
.then(() => {
const nodeList = select2DropdownOptions();
const names = [...nodeList].map(el => el.textContent);
const names = [...nodeList].map((el) => el.textContent);
expect(names).toEqual(branchNames());
})
......@@ -122,7 +122,7 @@ describe('Branches Select', () => {
});
});
it('emits input when data changes', async done => {
it('emits input when data changes', async (done) => {
await createComponent();
const selectedIndex = 1;
......
......@@ -55,7 +55,7 @@ describe('EE Approvals LicenseCompliance', () => {
wrapper = null;
});
const findByHrefAttribute = href => wrapper.find(`[href="${href}"]`);
const findByHrefAttribute = (href) => wrapper.find(`[href="${href}"]`);
const findOpenModalButton = () => wrapper.find('button');
const findLoadingIndicator = () => wrapper.find('[aria-label="loading"]');
const findInformationIcon = () => wrapper.find(GlIcon);
......
......@@ -72,7 +72,7 @@ describe('EE Approvals LicenseCompliance Modal', () => {
wrapper = null;
});
const findByHref = href => wrapper.find(`[href="${href}"`);
const findByHref = (href) => wrapper.find(`[href="${href}"`);
const findModal = () => wrapper.find(GlModalVuex);
const findRuleForm = () => wrapper.find(mocks.RuleForm);
const findInformationIcon = () => wrapper.find('[name="question"]');
......
......@@ -49,7 +49,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => {
});
const findHiddenInputs = () =>
wrapper.findAll('input[type=hidden]').wrappers.map(x => ({
wrapper.findAll('input[type=hidden]').wrappers.map((x) => ({
name: x.attributes('name'),
value: x.element.value,
}));
......@@ -137,7 +137,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => {
it('renders empty users input', () => {
factory();
expect(findHiddenInputs().filter(x => x.name === INPUT_USER_IDS)).toEqual([
expect(findHiddenInputs().filter((x) => x.name === INPUT_USER_IDS)).toEqual([
{ name: INPUT_USER_IDS, value: '' },
]);
});
......@@ -151,7 +151,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => {
it('renders empty groups input', () => {
factory();
expect(findHiddenInputs().filter(x => x.name === INPUT_GROUP_IDS)).toEqual([
expect(findHiddenInputs().filter((x) => x.name === INPUT_GROUP_IDS)).toEqual([
{ name: INPUT_GROUP_IDS, value: '' },
]);
});
......@@ -165,7 +165,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => {
it('does render id input', () => {
factory();
expect(findHiddenInputs().map(x => x.name)).toContain(INPUT_ID);
expect(findHiddenInputs().map((x) => x.name)).toContain(INPUT_ID);
});
describe('with source', () => {
......
......@@ -31,12 +31,12 @@ describe('EE Approvals MRRules', () => {
});
};
const findHeaders = () => wrapper.findAll('thead th').wrappers.map(x => x.text());
const findHeaders = () => wrapper.findAll('thead th').wrappers.map((x) => x.text());
const findRuleName = () => wrapper.find('.js-name');
const findRuleIndicator = () => wrapper.find({ ref: 'indicator' });
const findRuleMembers = () => wrapper.find('td.js-members').find(UserAvatarList).props('items');
const findRuleControls = () => wrapper.find('td.js-controls').find(RuleControls);
const callTargetBranchHandler = MutationObserverSpy => {
const callTargetBranchHandler = (MutationObserverSpy) => {
const onTargetBranchMutationHandler = MutationObserverSpy.mock.calls[0][0];
return onTargetBranchMutationHandler();
};
......@@ -45,7 +45,7 @@ describe('EE Approvals MRRules', () => {
OriginalMutationObserver = global.MutationObserver;
global.MutationObserver = jest
.fn()
.mockImplementation(args => new OriginalMutationObserver(args));
.mockImplementation((args) => new OriginalMutationObserver(args));
store = createStoreOptions(MREditModule());
store.modules.approvals.state = {
......@@ -157,7 +157,7 @@ describe('EE Approvals MRRules', () => {
factory();
const anyApproverCount = store.modules.approvals.state.rules.filter(
rule => rule.ruleType === 'any_approver',
(rule) => rule.ruleType === 'any_approver',
);
expect(anyApproverCount).toHaveLength(1);
......
......@@ -16,7 +16,7 @@ localVue.use(Vuex);
const findCell = (tr, name) => tr.find(`td.js-${name}`);
const getRowData = tr => {
const getRowData = (tr) => {
const name = findCell(tr, 'name');
const members = findCell(tr, 'members');
const approvalsRequired = findCell(tr, 'approvals-required');
......@@ -61,7 +61,7 @@ describe('Approvals ProjectRules', () => {
const data = rows.wrappers.map(getRowData);
expect(data).toEqual(
TEST_RULES.filter((rule, index) => index !== 0).map(rule => ({
TEST_RULES.filter((rule, index) => index !== 0).map((rule) => ({
name: rule.name,
approvers: rule.approvers,
approvalsRequired: rule.approvalsRequired,
......@@ -74,7 +74,7 @@ describe('Approvals ProjectRules', () => {
it('should always have any_approver rule', () => {
factory();
const hasAnyApproverRule = store.modules.approvals.state.rules.some(
rule => rule.ruleType === 'any_approver',
(rule) => rule.ruleType === 'any_approver',
);
expect(hasAnyApproverRule).toBe(true);
......@@ -133,7 +133,7 @@ describe('Approvals ProjectRules', () => {
describe.each([true, false])(
'when the approvalSuggestions feature flag is %p',
approvalSuggestions => {
(approvalSuggestions) => {
beforeEach(() => {
const rules = createProjectRules();
rules[0].name = 'Vulnerability-Check';
......
......@@ -41,7 +41,7 @@ const nameTakenError = {
const localVue = createLocalVue();
localVue.use(Vuex);
const addType = type => x => Object.assign(x, { type });
const addType = (type) => (x) => Object.assign(x, { type });
describe('EE Approvals RuleForm', () => {
let wrapper;
......@@ -88,7 +88,7 @@ describe('EE Approvals RuleForm', () => {
beforeEach(() => {
store = createStoreOptions(projectSettingsModule(), { projectId: TEST_PROJECT_ID });
['postRule', 'putRule', 'deleteRule', 'putFallbackRule'].forEach(actionName => {
['postRule', 'putRule', 'deleteRule', 'putFallbackRule'].forEach((actionName) => {
jest.spyOn(store.modules.approvals.actions, actionName).mockImplementation(() => {});
});
......@@ -114,7 +114,7 @@ describe('EE Approvals RuleForm', () => {
});
it('on load, it populates initial protected branch ids', () => {
expect(wrapper.vm.branches).toEqual(TEST_PROTECTED_BRANCHES.map(x => x.id));
expect(wrapper.vm.branches).toEqual(TEST_PROTECTED_BRANCHES.map((x) => x.id));
});
});
......@@ -128,14 +128,14 @@ describe('EE Approvals RuleForm', () => {
it('at first, shows no validation', () => {
const inputs = findValidationsWithBranch();
const invalidInputs = inputs.filter(x => !x.isValid);
const feedbacks = inputs.map(x => x.feedback);
const invalidInputs = inputs.filter((x) => !x.isValid);
const feedbacks = inputs.map((x) => x.feedback);
expect(invalidInputs.length).toBe(0);
expect(feedbacks.every(str => !str.length)).toBe(true);
expect(feedbacks.every((str) => !str.length)).toBe(true);
});
it('on submit, shows branches validation', done => {
it('on submit, shows branches validation', (done) => {
wrapper.vm.branches = ['3'];
wrapper.vm.submit();
......@@ -154,9 +154,9 @@ describe('EE Approvals RuleForm', () => {
it('on submit with data, posts rule', () => {
const users = [1, 2];
const groups = [2, 3];
const userRecords = users.map(id => ({ id, type: TYPE_USER }));
const groupRecords = groups.map(id => ({ id, type: TYPE_GROUP }));
const branches = TEST_PROTECTED_BRANCHES.map(x => x.id);
const userRecords = users.map((id) => ({ id, type: TYPE_USER }));
const groupRecords = groups.map((id) => ({ id, type: TYPE_GROUP }));
const branches = TEST_PROTECTED_BRANCHES.map((x) => x.id);
const expected = {
id: null,
name: 'Lorem',
......@@ -188,11 +188,11 @@ describe('EE Approvals RuleForm', () => {
it('at first, shows no validation', () => {
const inputs = findValidations();
const invalidInputs = inputs.filter(x => !x.isValid);
const feedbacks = inputs.map(x => x.feedback);
const invalidInputs = inputs.filter((x) => !x.isValid);
const feedbacks = inputs.map((x) => x.feedback);
expect(invalidInputs.length).toBe(0);
expect(feedbacks.every(str => !str.length)).toBe(true);
expect(feedbacks.every((str) => !str.length)).toBe(true);
});
it('on submit, does not dispatch action', () => {
......@@ -201,7 +201,7 @@ describe('EE Approvals RuleForm', () => {
expect(actions.postRule).not.toHaveBeenCalled();
});
it('on submit, shows name validation', done => {
it('on submit, shows name validation', (done) => {
findNameInput().setValue('');
wrapper.vm.submit();
......@@ -218,7 +218,7 @@ describe('EE Approvals RuleForm', () => {
.catch(done.fail);
});
it('on submit, shows approvalsRequired validation', done => {
it('on submit, shows approvalsRequired validation', (done) => {
findApprovalsRequiredInput().setValue(-1);
wrapper.vm.submit();
......@@ -235,7 +235,7 @@ describe('EE Approvals RuleForm', () => {
.catch(done.fail);
});
it('on submit, shows approvers validation', done => {
it('on submit, shows approvers validation', (done) => {
wrapper.vm.approvers = [];
wrapper.vm.submit();
......@@ -254,9 +254,9 @@ describe('EE Approvals RuleForm', () => {
describe('with valid data', () => {
const users = [1, 2];
const groups = [2, 3];
const userRecords = users.map(id => ({ id, type: TYPE_USER }));
const groupRecords = groups.map(id => ({ id, type: TYPE_GROUP }));
const branches = TEST_PROTECTED_BRANCHES.map(x => x.id);
const userRecords = users.map((id) => ({ id, type: TYPE_USER }));
const groupRecords = groups.map((id) => ({ id, type: TYPE_GROUP }));
const branches = TEST_PROTECTED_BRANCHES.map((x) => x.id);
const expected = {
id: null,
name: 'Lorem',
......@@ -333,10 +333,10 @@ describe('EE Approvals RuleForm', () => {
});
describe('with valid data', () => {
const userRecords = TEST_RULE.users.map(x => ({ ...x, type: TYPE_USER }));
const groupRecords = TEST_RULE.groups.map(x => ({ ...x, type: TYPE_GROUP }));
const users = userRecords.map(x => x.id);
const groups = groupRecords.map(x => x.id);
const userRecords = TEST_RULE.users.map((x) => ({ ...x, type: TYPE_USER }));
const groupRecords = TEST_RULE.groups.map((x) => ({ ...x, type: TYPE_GROUP }));
const users = userRecords.map((x) => x.id);
const groups = groupRecords.map((x) => x.id);
const expected = {
...TEST_RULE,
......@@ -392,7 +392,7 @@ describe('EE Approvals RuleForm', () => {
});
describe('with empty name and empty approvers', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper.vm.submit();
localVue.nextTick(done);
});
......@@ -408,12 +408,12 @@ describe('EE Approvals RuleForm', () => {
});
it('does not show any validation errors', () => {
expect(findValidations().every(x => x.isValid)).toBe(true);
expect(findValidations().every((x) => x.isValid)).toBe(true);
});
});
describe('with name and empty approvers', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper.vm.name = 'Lorem';
wrapper.vm.submit();
......@@ -430,7 +430,7 @@ describe('EE Approvals RuleForm', () => {
});
describe('with empty name and approvers', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper.vm.approvers = TEST_APPROVERS;
wrapper.vm.submit();
......@@ -447,7 +447,7 @@ describe('EE Approvals RuleForm', () => {
});
describe('with name and approvers', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper.vm.approvers = [{ id: 7, type: TYPE_USER }];
wrapper.vm.name = 'Lorem';
wrapper.vm.submit();
......@@ -498,7 +498,7 @@ describe('EE Approvals RuleForm', () => {
describe('and hidden groups removed', () => {
beforeEach(() => {
wrapper.vm.approvers = wrapper.vm.approvers.filter(x => x.type !== TYPE_HIDDEN_GROUPS);
wrapper.vm.approvers = wrapper.vm.approvers.filter((x) => x.type !== TYPE_HIDDEN_GROUPS);
});
it('on submit, removes hidden groups', () => {
......@@ -529,7 +529,7 @@ describe('EE Approvals RuleForm', () => {
expect(
findApproversList()
.props('value')
.every(x => x.type !== TYPE_HIDDEN_GROUPS),
.every((x) => x.type !== TYPE_HIDDEN_GROUPS),
).toBe(true);
});
});
......@@ -656,7 +656,7 @@ describe('EE Approvals RuleForm', () => {
expect.objectContaining({
name: expectedNameSubmitted,
approvalsRequired: TEST_APPROVALS_REQUIRED,
users: TEST_APPROVERS.map(x => x.id),
users: TEST_APPROVERS.map((x) => x.id),
}),
);
});
......@@ -712,7 +712,7 @@ describe('EE Approvals RuleForm', () => {
});
describe('with name and approvers', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper.vm.name = inputName;
wrapper.vm.approvers = TEST_APPROVERS;
wrapper.vm.submit();
......@@ -727,7 +727,7 @@ describe('EE Approvals RuleForm', () => {
id: TEST_RULE.id,
name: expectedNameSubmitted,
approvalsRequired: TEST_APPROVALS_REQUIRED,
users: TEST_APPROVERS.map(x => x.id),
users: TEST_APPROVERS.map((x) => x.id),
}),
);
});
......
......@@ -4,7 +4,7 @@ import testAction from 'helpers/vuex_action_helper';
describe('Approval MR edit module actions', () => {
describe('setTargetBranch', () => {
it('commits SET_TARGET_BRANCH', done => {
it('commits SET_TARGET_BRANCH', (done) => {
testAction(
actions.setTargetBranch,
'master',
......@@ -17,7 +17,7 @@ describe('Approval MR edit module actions', () => {
});
describe('undoRulesChange', () => {
it('commits UNDO_RULES', done => {
it('commits UNDO_RULES', (done) => {
testAction(actions.undoRulesChange, null, {}, [{ type: types.UNDO_RULES }], [], done);
});
});
......
......@@ -101,7 +101,7 @@ describe('EE approvals project settings module actions', () => {
{ type: 'receiveRulesSuccess', payload: mapApprovalSettingsResponse(data) },
],
() => {
expect(mock.history.get.map(x => x.url)).toEqual([TEST_SETTINGS_PATH]);
expect(mock.history.get.map((x) => x.url)).toEqual([TEST_SETTINGS_PATH]);
},
);
});
......
......@@ -19,7 +19,7 @@ describe('AuditEventsApp', () => {
let store;
const events = [{ foo: 'bar' }];
const filterTokenOptions = AVAILABLE_TOKEN_TYPES.map(type => ({ type }));
const filterTokenOptions = AVAILABLE_TOKEN_TYPES.map((type) => ({ type }));
const exportUrl = 'http://example.com/audit_log_reports.csv';
const initComponent = (props = {}) => {
......
......@@ -12,7 +12,7 @@ describe('SortingField component', () => {
};
const getCheckedOptions = () =>
wrapper.findAll(GlDropdownItem).filter(item => item.props().isChecked);
wrapper.findAll(GlDropdownItem).filter((item) => item.props().isChecked);
beforeEach(() => {
initComponent();
......
......@@ -19,7 +19,7 @@ describe('AuditFilterToken', () => {
];
const findFilteredSearchToken = () => wrapper.find('#filtered-search-token');
const findLoadingIcon = type => wrapper.find(type).find(GlLoadingIcon);
const findLoadingIcon = (type) => wrapper.find(type).find(GlLoadingIcon);
const tokenMethods = {
fetchItem: jest.fn().mockResolvedValue(item),
......
import subscriptionState from 'ee/billings/subscriptions/store/state';
export const resetStore = store => {
export const resetStore = (store) => {
const newState = {
subscription: subscriptionState(),
};
......
......@@ -55,7 +55,7 @@ describe('Subscription Seats', () => {
const findPageHeading = () => wrapper.find('[data-testid="heading"]');
const findPagination = () => wrapper.find(GlPagination);
const serializeUser = rowWrapper => {
const serializeUser = (rowWrapper) => {
const avatarLink = rowWrapper.find(GlAvatarLink);
const avatarLabeled = rowWrapper.find(GlAvatarLabeled);
......@@ -72,7 +72,7 @@ describe('Subscription Seats', () => {
};
};
const serializeTableRow = rowWrapper => {
const serializeTableRow = (rowWrapper) => {
const emailWrapper = rowWrapper.find('[data-testid="email"]');
return {
......@@ -82,7 +82,7 @@ describe('Subscription Seats', () => {
};
};
const findSerializedTable = tableWrapper => {
const findSerializedTable = (tableWrapper) => {
return tableWrapper.findAll('tbody tr').wrappers.map(serializeTableRow);
};
......@@ -141,7 +141,7 @@ describe('Subscription Seats', () => {
describe('pagination', () => {
it.each([null, NaN, undefined, 'a string', false])(
'will not render given %s for currentPage',
value => {
(value) => {
wrapper = createComponent({
initialState: {
page: value,
......
......@@ -100,7 +100,7 @@ describe('seats actions', () => {
});
describe('receiveBillableMembersListError', () => {
it('should commit the error mutation', done => {
it('should commit the error mutation', (done) => {
testAction(
actions.receiveBillableMembersListError,
{},
......
......@@ -76,7 +76,7 @@ describe('subscription table row', () => {
const findContentCells = () => wrapper.findAll('[data-testid="content-cell"]');
const findHeaderIcon = () => findHeaderCell().find(GlIcon);
const findColumnLabelAndTitle = columnWrapper => {
const findColumnLabelAndTitle = (columnWrapper) => {
const label = columnWrapper.find('[data-testid="property-label"]');
const value = columnWrapper.find('[data-testid="property-value"]');
......@@ -111,7 +111,7 @@ describe('subscription table row', () => {
});
it(`should not render a hidden column`, () => {
const hiddenColIdx = COLUMNS.find(c => !c.display);
const hiddenColIdx = COLUMNS.find((c) => !c.display);
const hiddenCol = findContentCells().at(hiddenColIdx);
expect(hiddenCol).toBe(undefined);
......
......@@ -39,7 +39,7 @@ describe('EE billings subscription module mutations', () => {
});
describe(types.RECEIVE_SUBSCRIPTION_SUCCESS, () => {
const getColumnValues = columns =>
const getColumnValues = (columns) =>
columns.reduce(
(acc, { id, value }) => ({
...acc,
......@@ -47,7 +47,7 @@ describe('EE billings subscription module mutations', () => {
}),
{},
);
const getStateTableValues = key =>
const getStateTableValues = (key) =>
state.tables[key].rows.map(({ columns }) => getColumnValues(columns));
describe.each`
......
......@@ -31,7 +31,7 @@ const assignee2 = {
};
describe('Assignee select component', () => {
beforeEach(done => {
beforeEach((done) => {
setFixtures('<div class="test-container"></div>');
boardsStore.create();
......@@ -55,7 +55,7 @@ describe('Assignee select component', () => {
});
describe('canEdit', () => {
it('hides Edit button', done => {
it('hides Edit button', (done) => {
vm.canEdit = false;
Vue.nextTick(() => {
expect(vm.$el.querySelector('.edit-link')).toBeFalsy();
......@@ -63,7 +63,7 @@ describe('Assignee select component', () => {
});
});
it('shows Edit button if true', done => {
it('shows Edit button if true', (done) => {
vm.canEdit = true;
Vue.nextTick(() => {
expect(vm.$el.querySelector('.edit-link')).toBeTruthy();
......@@ -77,7 +77,7 @@ describe('Assignee select component', () => {
expect(selectedText()).toContain('Any assignee');
});
it('shows selected assignee', done => {
it('shows selected assignee', (done) => {
vm.selected = assignee;
Vue.nextTick(() => {
expect(selectedText()).toContain('first assignee');
......@@ -97,7 +97,7 @@ describe('Assignee select component', () => {
mock.restore();
});
it('sets assignee', done => {
it('sets assignee', (done) => {
vm.$el.querySelector('.edit-link').click();
jest.runOnlyPendingTimers();
......
......@@ -75,13 +75,13 @@ describe('Board List Header Component', () => {
const hasSettings = [ListType.assignee, ListType.milestone, ListType.label];
const hasNoSettings = [ListType.backlog, ListType.closed];
it.each(hasSettings)('does render for List Type `%s`', listType => {
it.each(hasSettings)('does render for List Type `%s`', (listType) => {
createComponent({ listType });
expect(findSettingsButton().exists()).toBe(true);
});
it.each(hasNoSettings)('does not render for List Type `%s`', listType => {
it.each(hasNoSettings)('does not render for List Type `%s`', (listType) => {
createComponent({ listType });
expect(findSettingsButton().exists()).toBe(false);
......@@ -90,7 +90,7 @@ describe('Board List Header Component', () => {
it('has a test for each list type', () => {
createComponent();
Object.values(ListType).forEach(value => {
Object.values(ListType).forEach((value) => {
expect([...hasSettings, ...hasNoSettings]).toContain(value);
});
});
......
......@@ -84,20 +84,20 @@ describe('Board List Header Component', () => {
const hasSettings = [ListType.assignee, ListType.milestone, ListType.label];
const hasNoSettings = [ListType.backlog, ListType.closed];
it.each(hasSettings)('does render for List Type `%s`', listType => {
it.each(hasSettings)('does render for List Type `%s`', (listType) => {
createComponent({ listType });
expect(findSettingsButton().exists()).toBe(true);
});
it.each(hasNoSettings)('does not render for List Type `%s`', listType => {
it.each(hasNoSettings)('does not render for List Type `%s`', (listType) => {
createComponent({ listType });
expect(findSettingsButton().exists()).toBe(false);
});
it('has a test for each list type', () => {
Object.values(ListType).forEach(value => {
Object.values(ListType).forEach((value) => {
expect([...hasSettings, ...hasNoSettings]).toContain(value);
});
});
......
......@@ -51,7 +51,7 @@ describe('BoardListSelector', () => {
describe('methods', () => {
describe('loadList', () => {
it('calls axios.get and sets response to store.state.assignees', done => {
it('calls axios.get and sets response to store.state.assignees', (done) => {
mock.onGet(dummyEndpoint).reply(200, mockAssigneesList);
boardsStore.state.assignees = [];
......@@ -64,7 +64,7 @@ describe('BoardListSelector', () => {
.catch(done.fail);
});
it('does not call axios.get when store.state.assignees is not empty', done => {
it('does not call axios.get when store.state.assignees is not empty', (done) => {
jest.spyOn(axios, 'get').mockReturnValue(Promise.resolve());
boardsStore.state.assignees = mockAssigneesList;
......@@ -76,7 +76,7 @@ describe('BoardListSelector', () => {
.catch(done.fail);
});
it('calls axios.get and shows Flash error when request fails', done => {
it('calls axios.get and shows Flash error when request fails', (done) => {
mock.onGet(dummyEndpoint).replyOnce(500, {});
boardsStore.state.assignees = [];
......
......@@ -4,7 +4,7 @@ describe('BoardList Component', () => {
let mock;
let component;
beforeEach(done => {
beforeEach((done) => {
const listIssueProps = {
project: {
path: '/test',
......
......@@ -11,7 +11,7 @@ describe('BoardSettingsListType', () => {
},
assignee: { webUrl: 'https://gitlab.com/root', name: 'root', username: 'root' },
};
const createComponent = props => {
const createComponent = (props) => {
wrapper = shallowMount(BoardSettingsListTypes, {
propsData: { ...props, activeList },
});
......
......@@ -62,7 +62,7 @@ describe('BoardSettingsWipLimit', () => {
});
};
const triggerBlur = type => {
const triggerBlur = (type) => {
if (type === 'blur') {
findInput().vm.$emit('blur');
}
......
......@@ -12,7 +12,7 @@ localVue.use(Vuex);
describe('EpicLane', () => {
let wrapper;
const findByTestId = testId => wrapper.find(`[data-testid="${testId}"]`);
const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`);
const updateBoardEpicUserPreferencesSpy = jest.fn();
......
......@@ -8,7 +8,7 @@ const TEST_EPIC_ID = 8;
const TEST_EPIC = { id: 'gid://gitlab/Epic/1', title: 'Test epic' };
const TEST_ISSUE = { id: 'gid://gitlab/Issue/1', iid: 9, epic: null, referencePath: 'h/b#2' };
jest.mock('~/lib/utils/common_utils', () => ({ debounceByAnimationFrame: callback => callback }));
jest.mock('~/lib/utils/common_utils', () => ({ debounceByAnimationFrame: (callback) => callback }));
describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
let wrapper;
......
......@@ -15,7 +15,7 @@ describe('BoardSidebarTimeTracker', () => {
let wrapper;
let store;
const createComponent = options => {
const createComponent = (options) => {
wrapper = shallowMount(BoardSidebarTimeTracker, {
store,
...options,
......@@ -42,7 +42,7 @@ describe('BoardSidebarTimeTracker', () => {
it.each([[true], [false]])(
'renders IssuableTimeTracker with correct spent and estimated time (timeTrackingLimitToHours=%s)',
timeTrackingLimitToHours => {
(timeTrackingLimitToHours) => {
createComponent({ provide: { timeTrackingLimitToHours } });
expect(wrapper.find(IssuableTimeTracker).props()).toEqual({
......
......@@ -8,7 +8,7 @@ describe('WeightSelect', () => {
const editButton = () => wrapper.find(GlButton);
const valueContainer = () => wrapper.find('.value');
const weightDropdown = () => wrapper.find(GlDropdown);
const getWeightItemAtIndex = index => weightDropdown().findAll(GlDropdownItem).at(index);
const getWeightItemAtIndex = (index) => weightDropdown().findAll(GlDropdownItem).at(index);
const defaultProps = {
weights: ['Any', 'None', 0, 1, 2, 3],
board: {
......
......@@ -33,7 +33,7 @@ const milestone2 = {
};
describe('Milestone select component', () => {
beforeEach(done => {
beforeEach((done) => {
setFixtures('<div class="test-container"></div>');
// eslint-disable-next-line no-new
......@@ -53,7 +53,7 @@ describe('Milestone select component', () => {
});
describe('canEdit', () => {
it('hides Edit button', done => {
it('hides Edit button', (done) => {
vm.canEdit = false;
Vue.nextTick(() => {
expect(vm.$el.querySelector('.edit-link')).toBeFalsy();
......@@ -61,7 +61,7 @@ describe('Milestone select component', () => {
});
});
it('shows Edit button if true', done => {
it('shows Edit button if true', (done) => {
vm.canEdit = true;
Vue.nextTick(() => {
expect(vm.$el.querySelector('.edit-link')).toBeTruthy();
......@@ -75,7 +75,7 @@ describe('Milestone select component', () => {
expect(selectedText()).toContain('Any milestone');
});
it('shows No milestone', done => {
it('shows No milestone', (done) => {
vm.board.milestone_id = 0;
Vue.nextTick(() => {
expect(selectedText()).toContain('No milestone');
......@@ -83,7 +83,7 @@ describe('Milestone select component', () => {
});
});
it('shows selected milestone title', done => {
it('shows selected milestone title', (done) => {
vm.board.milestone_id = 20;
vm.board.milestone = {
id: 20,
......@@ -100,7 +100,7 @@ describe('Milestone select component', () => {
jest.spyOn(Api, 'projectMilestones').mockResolvedValue({ data: [milestone, milestone2] });
});
it('sets Any milestone', async done => {
it('sets Any milestone', async (done) => {
vm.board.milestone_id = 0;
vm.$el.querySelector('.edit-link').click();
......@@ -118,7 +118,7 @@ describe('Milestone select component', () => {
});
});
it('sets No milestone', done => {
it('sets No milestone', (done) => {
vm.$el.querySelector('.edit-link').click();
jest.runOnlyPendingTimers();
......@@ -134,7 +134,7 @@ describe('Milestone select component', () => {
});
});
it('sets milestone', done => {
it('sets milestone', (done) => {
vm.$el.querySelector('.edit-link').click();
jest.runOnlyPendingTimers();
......
......@@ -36,7 +36,7 @@ export const mockLists = [
},
];
export const mockListsWithModel = mockLists.map(listMock =>
export const mockListsWithModel = mockLists.map((listMock) =>
Vue.observable(new List({ ...listMock, doNotFetchIssues: true })),
);
......
......@@ -12,7 +12,7 @@ import * as commonUtils from '~/lib/utils/common_utils';
import { mergeUrlParams, removeParams } from '~/lib/utils/url_utility';
import { mockLists, mockIssue, mockIssue2, mockEpic, rawIssue } from '../mock_data';
const expectNotImplemented = action => {
const expectNotImplemented = (action) => {
it('is not implemented', () => {
expect(action).toThrow(new Error('Not implemented!'));
});
......@@ -101,7 +101,7 @@ describe('setFilters', () => {
});
describe('performSearch', () => {
it('should dispatch setFilters action', done => {
it('should dispatch setFilters action', (done) => {
testAction(actions.performSearch, {}, {}, [], [{ type: 'setFilters', payload: {} }], done);
});
......@@ -156,7 +156,7 @@ describe('fetchEpicsSwimlanes', () => {
},
};
it('should commit mutation RECEIVE_EPICS_SUCCESS on success without lists', done => {
it('should commit mutation RECEIVE_EPICS_SUCCESS on success without lists', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction(
......@@ -174,7 +174,7 @@ describe('fetchEpicsSwimlanes', () => {
);
});
it('should commit mutation RECEIVE_SWIMLANES_FAILURE on failure', done => {
it('should commit mutation RECEIVE_SWIMLANES_FAILURE on failure', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject());
testAction(
......@@ -187,7 +187,7 @@ describe('fetchEpicsSwimlanes', () => {
);
});
it('should dispatch fetchEpicsSwimlanes when page info hasNextPage', done => {
it('should dispatch fetchEpicsSwimlanes when page info hasNextPage', (done) => {
const queryResponseWithNextPage = {
data: {
group: {
......@@ -240,7 +240,7 @@ describe('updateBoardEpicUserPreferences', () => {
},
});
it('should send mutation', done => {
it('should send mutation', (done) => {
const collapsed = true;
jest.spyOn(gqlClient, 'mutate').mockResolvedValue(queryResponse(collapsed));
......@@ -266,7 +266,7 @@ describe('updateBoardEpicUserPreferences', () => {
});
describe('setShowLabels', () => {
it('should commit mutation SET_SHOW_LABELS', done => {
it('should commit mutation SET_SHOW_LABELS', (done) => {
const state = {
isShowingLabels: true,
};
......@@ -417,7 +417,7 @@ describe('fetchIssuesForEpic', () => {
const formattedIssues = formatListIssues(queryResponse.data.group.board.lists);
it('should commit mutations REQUEST_ISSUES_FOR_EPIC and RECEIVE_ISSUES_FOR_LIST_SUCCESS on success', done => {
it('should commit mutations REQUEST_ISSUES_FOR_EPIC and RECEIVE_ISSUES_FOR_LIST_SUCCESS on success', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction(
......@@ -433,7 +433,7 @@ describe('fetchIssuesForEpic', () => {
);
});
it('should commit mutations REQUEST_ISSUES_FOR_EPIC and RECEIVE_ISSUES_FOR_LIST_FAILURE on failure', done => {
it('should commit mutations REQUEST_ISSUES_FOR_EPIC and RECEIVE_ISSUES_FOR_LIST_FAILURE on failure', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject());
testAction(
......@@ -571,7 +571,7 @@ describe('setActiveIssueWeight', () => {
projectPath: 'h/b',
};
it('should commit weight after setting the issue', done => {
it('should commit weight after setting the issue', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: {
issueSetWeight: {
......@@ -636,7 +636,7 @@ describe('moveIssue', () => {
issues,
};
it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_SUCCESS mutation when successful', done => {
it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_SUCCESS mutation when successful', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: {
issueMoveList: {
......@@ -677,7 +677,7 @@ describe('moveIssue', () => {
);
});
it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful', done => {
it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: {
issueMoveList: {
......
......@@ -99,7 +99,7 @@ describe('BoardsStoreEE', () => {
beforeEach(() => {
requestSpy = jest.fn();
axiosMock.onPut(dummyEndpoint).replyOnce(config => requestSpy(config));
axiosMock.onPut(dummyEndpoint).replyOnce((config) => requestSpy(config));
});
it('makes a request to update the weight', () => {
......
import mutations from 'ee/boards/stores/mutations';
import { mockIssue, mockIssue2, mockEpics, mockEpic, mockLists } from '../mock_data';
const expectNotImplemented = action => {
const expectNotImplemented = (action) => {
it('is not implemented', () => {
expect(action).toThrow(new Error('Not implemented!'));
});
......
......@@ -24,7 +24,7 @@ describe('burndown_chart', () => {
const findIssuesButton = () => wrapper.find({ ref: 'totalIssuesButton' });
const findWeightButton = () => wrapper.find({ ref: 'totalWeightButton' });
const findActiveButtons = () =>
wrapper.findAll(GlButton).filter(button => button.attributes().category === 'primary');
wrapper.findAll(GlButton).filter((button) => button.attributes().category === 'primary');
const findBurndownChart = () => wrapper.find(BurndownChart);
const findBurnupChart = () => wrapper.find(BurnupChart);
const findOldBurndownChartButton = () => wrapper.find({ ref: 'oldBurndown' });
......
......@@ -28,19 +28,19 @@ describe('Codequality report actions', () => {
});
describe('setPage', () => {
it('sets the page number', done => {
it('sets the page number', (done) => {
testAction(actions.setPage, 12, state, [{ type: types.SET_PAGE, payload: 12 }], [], done);
});
});
describe('requestReport', () => {
it('sets the loading flag', done => {
it('sets the loading flag', (done) => {
testAction(actions.requestReport, null, state, [{ type: types.REQUEST_REPORT }], [], done);
});
});
describe('receiveReportSuccess', () => {
it('parses the list of issues from the report', done => {
it('parses the list of issues from the report', (done) => {
testAction(
actions.receiveReportSuccess,
unparsedIssues,
......@@ -53,7 +53,7 @@ describe('Codequality report actions', () => {
});
describe('receiveReportError', () => {
it('accepts a report error', done => {
it('accepts a report error', (done) => {
testAction(
actions.receiveReportError,
'error',
......@@ -70,7 +70,7 @@ describe('Codequality report actions', () => {
mock.onGet(endpoint).replyOnce(200, unparsedIssues);
});
it('fetches the report', done => {
it('fetches the report', (done) => {
testAction(
actions.fetchReport,
null,
......@@ -81,7 +81,7 @@ describe('Codequality report actions', () => {
);
});
it('shows a flash message when there is an error', done => {
it('shows a flash message when there is an error', (done) => {
testAction(
actions.fetchReport,
'error',
......@@ -97,7 +97,7 @@ describe('Codequality report actions', () => {
);
});
it('shows an error when blob path is missing', done => {
it('shows an error when blob path is missing', (done) => {
testAction(
actions.fetchReport,
null,
......
......@@ -8,7 +8,7 @@ const IMAGE_PATH = 'empty.svg';
describe('EmptyState component', () => {
let wrapper;
const emptyStateProp = prop => wrapper.find(GlEmptyState).props(prop);
const emptyStateProp = (prop) => wrapper.find(GlEmptyState).props(prop);
const createComponent = (props = {}) => {
return shallowMount(EmptyState, {
......
......@@ -8,7 +8,7 @@ describe('BranchDetails component', () => {
// The truncate component adds left-to-right marks into the text that we have to remove
const getText = () => wrapper.text().replace(/\u200E/gi, '');
const linkExists = testId => wrapper.find(`[data-testid="${testId}"]`).exists();
const linkExists = (testId) => wrapper.find(`[data-testid="${testId}"]`).exists();
const createComponent = ({ sourceUri = '', targetUri = '' } = {}) => {
return mount(BranchDetails, {
......
......@@ -53,7 +53,7 @@ describe('MergeRequestsGrid component', () => {
const mergeRequest = createMergeRequests({ count: 1 });
wrapper = createComponent(mergeRequest);
findStatuses().wrappers.forEach(status => {
findStatuses().wrappers.forEach((status) => {
const { type, data } = status.props('status');
switch (type) {
......
......@@ -9,7 +9,7 @@ describe('MergeRequest component', () => {
const findAuthorAvatarLink = () => wrapper.find('.issuable-authored').find(GlAvatarLink);
const createComponent = mergeRequest => {
const createComponent = (mergeRequest) => {
return shallowMount(MergeRequest, {
propsData: {
mergeRequest,
......
......@@ -7,7 +7,7 @@ import Pipeline from 'ee/compliance_dashboard/components/merge_requests/statuses
describe('Status component', () => {
let wrapper;
const createComponent = status => {
const createComponent = (status) => {
return shallowMount(Status, {
propsData: { status },
});
......@@ -34,7 +34,7 @@ describe('Status component', () => {
${'approval'} | ${null}
${'approval'} | ${''}
${'pipeline'} | ${{}}
`('does not render if given the status $value', status => {
`('does not render if given the status $value', (status) => {
wrapper = createComponent(status);
checkStatusComponentExists(status, false);
......@@ -44,7 +44,7 @@ describe('Status component', () => {
type | data
${'approval'} | ${'success'}
${'pipeline'} | ${{ group: 'warning' }}
`('renders if given the status $value', status => {
`('renders if given the status $value', (status) => {
wrapper = createComponent(status);
checkStatusComponentExists(status, true);
......
......@@ -9,7 +9,7 @@ describe('ApprovalStatus component', () => {
const findIcon = () => wrapper.find('.ci-icon');
const findLink = () => wrapper.find(GlLink);
const createComponent = status => {
const createComponent = (status) => {
return shallowMount(Approval, {
propsData: { status },
stubs: {
......
......@@ -10,7 +10,7 @@ describe('Pipeline component', () => {
const findCiIcon = () => wrapper.find('.ci-icon');
const findCiLink = () => wrapper.find(GlLink);
const createComponent = status => {
const createComponent = (status) => {
return shallowMount(Pipeline, {
propsData: { status },
stubs: {
......
......@@ -5,7 +5,7 @@ import GridColumnHeading from 'ee/compliance_dashboard/components/shared/grid_co
describe('GridColumnHeading component', () => {
let wrapper;
const createComponent = heading => {
const createComponent = (heading) => {
return shallowMount(GridColumnHeading, {
propsData: { heading },
});
......
......@@ -7,7 +7,7 @@ describe('Pagination component', () => {
let wrapper;
const findGlPagination = () => wrapper.find(GlPagination);
const getLink = query => wrapper.find(query).element.getAttribute('href');
const getLink = (query) => wrapper.find(query).element.getAttribute('href');
const findPrevPageLink = () => getLink('a.prev-page-item');
const findNextPageLink = () => getLink('a.next-page-item');
......
const createUser = id => ({
const createUser = (id) => ({
id,
avatar_url: `https://${id}`,
name: `User ${id}`,
......@@ -16,7 +16,7 @@ export const mergedAt = () => {
return date.toISOString();
};
export const createPipelineStatus = status => ({
export const createPipelineStatus = (status) => ({
details_path: '/h5bp/html5-boilerplate/pipelines/58',
favicon: '',
group: status,
......@@ -45,7 +45,7 @@ export const createMergeRequest = ({ id = 1, props } = {}) => {
return { ...mergeRequest, ...props };
};
export const createApprovers = count => {
export const createApprovers = (count) => {
return Array(count)
.fill(null)
.map((_, id) => createUser(id));
......
......@@ -27,7 +27,7 @@ describe('DependenciesApp component', () => {
store = createStore();
jest.spyOn(store, 'dispatch').mockImplementation();
const stubs = Object.keys(DependenciesApp.components).filter(name => name !== 'GlSprintf');
const stubs = Object.keys(DependenciesApp.components).filter((name) => name !== 'GlSprintf');
wrapper = mount(DependenciesApp, {
store,
......@@ -107,7 +107,7 @@ describe('DependenciesApp component', () => {
expect(componentWrapper.props()).toEqual(expect.objectContaining(props));
};
const expectComponentPropsToMatchSnapshot = Component => {
const expectComponentPropsToMatchSnapshot = (Component) => {
const componentWrapper = wrapper.find(Component);
expect(componentWrapper.props()).toMatchSnapshot();
};
......
......@@ -41,7 +41,7 @@ describe('DependenciesActions component', () => {
it('dispatches the right setSortField action on clicking each item in the dropdown', () => {
const dropdownItems = wrapper.findAll(GlDropdownItem).wrappers;
dropdownItems.forEach(item => {
dropdownItems.forEach((item) => {
// trigger() does not work on stubbed/shallow mounted components
// https://github.com/vuejs/vue-test-utils/issues/919
item.vm.$emit('click');
......@@ -49,7 +49,7 @@ describe('DependenciesActions component', () => {
expect(store.dispatch.mock.calls).toEqual(
expect.arrayContaining(
Object.keys(SORT_FIELDS).map(field => [`${namespace}/setSortField`, field]),
Object.keys(SORT_FIELDS).map((field) => [`${namespace}/setSortField`, field]),
),
);
});
......
......@@ -5,7 +5,7 @@ import DependenciesLicenseLinks from 'ee/dependencies/components/dependency_lice
describe('DependencyLicenseLinks component', () => {
// data helpers
const createLicenses = n => [...Array(n).keys()].map(i => ({ name: `license ${i + 1}` }));
const createLicenses = (n) => [...Array(n).keys()].map((i) => ({ name: `license ${i + 1}` }));
const addUrls = (licenses, numLicensesWithUrls = Infinity) =>
licenses.map((ls, i) => ({
...ls,
......@@ -26,7 +26,7 @@ describe('DependencyLicenseLinks component', () => {
};
// query helpers
const jsTestClassSelector = name => `.js-license-links-${name}`;
const jsTestClassSelector = (name) => `.js-license-links-${name}`;
const findLicensesList = () => wrapper.find(jsTestClassSelector('license-list'));
const findLicenseListItems = () => wrapper.findAll(jsTestClassSelector('license-list-item'));
const findModal = () => wrapper.find(jsTestClassSelector('modal'));
......@@ -46,7 +46,7 @@ describe('DependencyLicenseLinks component', () => {
expect(intersperseInstance.attributes('lastseparator')).toBe(' and ');
});
it.each([3, 5, 8, 13])('limits the number of visible licenses to 2', numLicenses => {
it.each([3, 5, 8, 13])('limits the number of visible licenses to 2', (numLicenses) => {
factory({ numLicenses });
expect(findLicenseListItems()).toHaveLength(2);
......@@ -76,7 +76,7 @@ describe('DependencyLicenseLinks component', () => {
const links = wrapper.findAll(GlLink);
links.wrappers.forEach(link => {
links.wrappers.forEach((link) => {
expect(link.attributes('target')).toBe('_blank');
});
});
......
......@@ -43,7 +43,7 @@ describe('DependencyListJobFailedAlert component', () => {
it.each([undefined, null, ''])(
'does not include a button if "jobPath" is given but empty',
jobPath => {
(jobPath) => {
factory({ propsData: { jobPath } });
expect(wrapper.find(GlAlert).props()).toMatchObject(NO_BUTTON_PROPS);
......
......@@ -13,7 +13,7 @@ describe('EE DiffLineNoteForm', () => {
let saveDraft;
let wrapper;
const createStoreOptions = headSha => {
const createStoreOptions = (headSha) => {
const state = {
notes: {
notesData: { draftsPath: null },
......
......@@ -64,7 +64,7 @@ describe('ee/environments/components/canary_ingress.vue', () => {
it('is set to open the change modal', () => {
stableWeightDropdown
.findAll(GlDropdownItem)
.wrappers.forEach(w =>
.wrappers.forEach((w) =>
expect(getBinding(w.element, 'gl-modal')).toMatchObject({ value: CANARY_UPDATE_MODAL }),
);
});
......
......@@ -23,7 +23,7 @@ describe('Deploy Board', () => {
});
describe('with valid data', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper = createComponent();
wrapper.vm.$nextTick(done);
});
......@@ -73,7 +73,7 @@ describe('Deploy Board', () => {
});
describe('with empty state', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper = createComponent({
deployBoardData: {},
isLoading: false,
......@@ -92,7 +92,7 @@ describe('Deploy Board', () => {
});
describe('with loading state', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper = createComponent({
deployBoardData: {},
isLoading: true,
......@@ -109,7 +109,7 @@ describe('Deploy Board', () => {
describe('has legend component', () => {
let statuses = [];
beforeEach(done => {
beforeEach((done) => {
wrapper = createComponent({
isLoading: false,
isEmpty: false,
......@@ -127,7 +127,7 @@ describe('Deploy Board', () => {
expect(deployBoardLegend.findAll('a')).toHaveLength(Object.keys(statuses).length);
});
Object.keys(statuses).forEach(item => {
Object.keys(statuses).forEach((item) => {
it(`with ${item} text next to deployment instance icon`, () => {
expect(wrapper.find(`.deployment-instance-${item}`)).toBeDefined();
expect(wrapper.find(`.deployment-instance-${item} + .legend-text`).text()).toBe(
......
......@@ -31,7 +31,7 @@ describe('Environment', () => {
return axios.waitForAll();
};
const mockRequest = environmentList => {
const mockRequest = (environmentList) => {
mock.onGet(mockData.endpoint).reply(
200,
{
......
......@@ -80,7 +80,7 @@ describe('Environment table', () => {
expect(wrapper.find('.deploy-board-icon').exists()).toBe(true);
});
it('should toggle deploy board visibility when arrow is clicked', done => {
it('should toggle deploy board visibility when arrow is clicked', (done) => {
const mockItem = {
name: 'review',
size: 1,
......@@ -98,7 +98,7 @@ describe('Environment table', () => {
isDeployBoardVisible: false,
};
eventHub.$on('toggleDeployBoard', env => {
eventHub.$on('toggleDeployBoard', (env) => {
expect(env.id).toEqual(mockItem.id);
done();
});
......
......@@ -104,7 +104,7 @@ export const environment = {
updated_at: '2016-11-10T15:55:58.778Z',
};
const sharedEnvironmentData = id => ({
const sharedEnvironmentData = (id) => ({
environment_path: `/root/review-app/environments/${id}`,
external_url: null,
folderName: 'build',
......
......@@ -68,7 +68,7 @@ describe('Project Header', () => {
const removeLink = wrapper
.find(GlDropdown)
.findAll(GlDropdownItem)
.filter(w => w.text() === 'Remove');
.filter((w) => w.text() === 'Remove');
expect(removeLink.exists()).toBe(true);
});
......@@ -76,7 +76,7 @@ describe('Project Header', () => {
const removeLink = wrapper
.find(GlDropdown)
.findAll(GlDropdownItem)
.filter(w => w.text() === 'Remove');
.filter((w) => w.text() === 'Remove');
removeLink.at(0).vm.$emit('click');
return wrapper.vm.$nextTick().then(() => {
......
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