Commit 6e183d50 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 29 spec files: 1 of 10

Mandatory not to break master. Automatically created with prettier.
parent 281fda79
......@@ -11,15 +11,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.md
# temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively:
ee/spec/frontend/api_spec.js
ee/spec/frontend/admin/dev_ops_report
ee/spec/frontend/analytics/code_review_analytics/components
ee/spec/frontend/analytics/contribution_analytics/components
ee/spec/frontend/analytics/cycle_analytics
ee/spec/frontend/analytics/merge_request_analytics
ee/spec/frontend/analytics/productivity_analytics
ee/spec/frontend/analytics/repository_analytics/components
ee/spec/frontend/analytics/shared/components
ee/spec/frontend/approvals/components
ee/spec/frontend/audit_events/components
ee/spec/frontend/billings/subscriptions/components
......
......@@ -34,10 +34,7 @@ describe('DevopsAdoptionTable', () => {
const findCol = testId => findTable().find(`[data-testid="${testId}"]`);
const findColRowChild = (col, row, child) =>
findTable()
.findAll(`[data-testid="${col}"]`)
.at(row)
.find(child);
findTable().findAll(`[data-testid="${col}"]`).at(row).find(child);
const findColSubComponent = (colTestId, childComponent) =>
findCol(colTestId).find(childComponent);
......
export const groupData = [{ id: '1', full_name: 'Foo' }, { id: '2', full_name: 'Bar' }];
export const groupData = [
{ id: '1', full_name: 'Foo' },
{ id: '2', full_name: 'Bar' },
];
export const pageData = {
'x-next-page': 2,
......@@ -17,7 +20,10 @@ export const groupNodes = [
},
];
export const groupNodeLabelValues = [{ label: 'Foo', value: '1' }, { label: 'Bar', value: '2' }];
export const groupNodeLabelValues = [
{ label: 'Foo', value: '1' },
{ label: 'Bar', value: '2' },
];
export const groupIds = ['1', '2'];
......
......@@ -41,14 +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) => {
......
import { mount } from '@vue/test-utils';
import Component from 'ee/analytics/contribution_analytics/components/column_chart.vue';
const mockChartData = [['root', 100], ['desiree', 30], ['katlyn', 70], ['myrtis', 0]];
const mockChartData = [
['root', 100],
['desiree', 30],
['katlyn', 70],
['myrtis', 0],
];
describe('Contribution Analytics Column Chart', () => {
let wrapper;
......
......@@ -153,10 +153,7 @@ describe('Value Stream Analytics component', () => {
}
const findStageNavItemAtIndex = index =>
wrapper
.find(StageTableNav)
.findAll(StageNavItem)
.at(index);
wrapper.find(StageTableNav).findAll(StageNavItem).at(index);
const findAddStageButton = () => wrapper.find(AddStageButton);
......
......@@ -415,9 +415,7 @@ describe('CustomStageForm', () => {
});
it(`emits the ${STAGE_ACTIONS.UPDATE} action when clicking on a stage to recover`, async () => {
findRecoverStageDropdown()
.find(GlDropdownItem)
.vm.$emit('click');
findRecoverStageDropdown().find(GlDropdownItem).vm.$emit('click');
await wrapper.vm.$nextTick();
expect(wrapper.emitted()).toEqual({
......
......@@ -65,10 +65,7 @@ describe('DurationChart', () => {
const findLoader = _wrapper => _wrapper.find(ChartSkeletonLoader);
const selectStage = (_wrapper, index = 0) => {
findStageDropdown(_wrapper)
.findAll(GlDropdownItem)
.at(index)
.vm.$emit('click');
findStageDropdown(_wrapper).findAll(GlDropdownItem).at(index).vm.$emit('click');
};
beforeEach(() => {
......
......@@ -186,13 +186,19 @@ describe('Filter bar', () => {
[
'selectedLabelList',
'label_name',
[{ value: 'Afternix', operator: '=' }, { value: 'Brouceforge', operator: '=' }],
[
{ value: 'Afternix', operator: '=' },
{ value: 'Brouceforge', operator: '=' },
],
['Afternix', 'Brouceforge'],
],
[
'selectedAssigneeList',
'assignee_username',
[{ value: 'rootUser', operator: '=' }, { value: 'secondaryUser', operator: '=' }],
[
{ value: 'rootUser', operator: '=' },
{ value: 'secondaryUser', operator: '=' },
],
['rootUser', 'secondaryUser'],
],
])('with a %s updates the %s url parameter', (stateKey, paramKey, payload, result) => {
......
......@@ -22,9 +22,7 @@ describe('PathNavigation', () => {
};
const clickItemAt = index => {
pathNavigationItems()
.at(index)
.trigger('click');
pathNavigationItems().at(index).trigger('click');
};
beforeEach(() => {
......
......@@ -39,10 +39,7 @@ describe('StageDropdownFilter component', () => {
const findDropdown = () => wrapper.find(GlDropdown);
const selectDropdownItemAtIndex = index =>
findDropdown()
.findAll(GlDropdownItem)
.at(index)
.vm.$emit('click');
findDropdown().findAll(GlDropdownItem).at(index).vm.$emit('click');
describe('on stage click', () => {
describe('clicking a selected stage', () => {
......
......@@ -27,10 +27,7 @@ describe('StageTableNav', () => {
});
function selectStage(index) {
wrapper
.findAll(StageNavItem)
.at(index)
.trigger('click');
wrapper.findAll(StageNavItem).at(index).trigger('click');
}
describe('when a stage is clicked', () => {
......
......@@ -23,9 +23,7 @@ const findSelectedSubjectFilters = ctx => findSubjectFilters(ctx).attributes('ch
const findDropdownLabels = ctx => ctx.find(LabelsSelector).findAll(GlDropdownItem);
const selectLabelAtIndex = (ctx, index) => {
findDropdownLabels(ctx)
.at(index)
.trigger('click');
findDropdownLabels(ctx).at(index).trigger('click');
return waitForPromises();
};
......@@ -189,10 +187,7 @@ describe('TasksByTypeFilters', () => {
wrapper = createComponent({ mountFn: mount });
expect(wrapper.emitted('updateFilter')).toBeUndefined();
findSubjectFilters(wrapper)
.findAll('label:not(.active)')
.at(0)
.trigger('click');
findSubjectFilters(wrapper).findAll('label:not(.active)').at(0).trigger('click');
return wrapper.vm.$nextTick(() => {
expect(wrapper.emitted('updateFilter')).toBeDefined();
......
......@@ -38,7 +38,10 @@ export const endpoints = {
valueStreamData: /analytics\/value_stream_analytics\/value_streams/,
};
export const valueStreams = [{ id: 1, name: 'Value stream 1' }, { id: 2, name: 'Value stream 2' }];
export const valueStreams = [
{ id: 1, name: 'Value stream 1' },
{ id: 2, name: 'Value stream 2' },
];
export const groupLabels = getJSONFixture(fixtureEndpoints.groupLabels).map(
convertObjectPropsToCamelCase,
......@@ -184,7 +187,11 @@ export const transformedStagePathData = transformStagesForPathNavigation({
export const tasksByTypeData = {
seriesNames: ['Cool label', 'Normal label'],
data: [[0, 1, 2], [5, 2, 3], [2, 4, 1]],
data: [
[0, 1, 2],
[5, 2, 3],
[2, 4, 1],
],
groupBy: ['Group 1', 'Group 2', 'Group 3'],
};
......
......@@ -160,8 +160,8 @@ describe('Value Stream Analytics mutations', () => {
]);
expect(stateWithData.medians).toEqual({
'1': { value: 20, error: null },
'2': { value: 10, error: null },
1: { value: 20, error: null },
2: { value: 10, error: null },
});
});
});
......
......@@ -206,7 +206,10 @@ describe('ThroughputChart', () => {
selectedAssignee: { value: assigneeUsername, operator },
selectedAuthor: { value: authorUsername, operator },
selectedMilestone: { value: milestoneTitle, operator },
selectedLabelList: [{ value: labels[0], operator }, { value: labels[1], operator }],
selectedLabelList: [
{ value: labels[0], operator },
{ value: labels[1], operator },
],
});
await wrapper.vm.$nextTick();
expect(
......
......@@ -78,15 +78,9 @@ describe('ThroughputTable', () => {
const findPagination = () => wrapper.find(GlPagination);
const findPrevious = () =>
findPagination()
.findAll('.page-item')
.at(0);
const findPrevious = () => findPagination().findAll('.page-item').at(0);
const findNext = () =>
findPagination()
.findAll('.page-item')
.at(1);
const findNext = () => findPagination().findAll('.page-item').at(1);
afterEach(() => {
wrapper.destroy();
......@@ -472,7 +466,10 @@ describe('ThroughputTable', () => {
selectedAssignee: { value: assigneeUsername, operator },
selectedAuthor: { value: authorUsername, operator },
selectedMilestone: { value: milestoneTitle, operator },
selectedLabelList: [{ value: labels[0], operator }, { value: labels[1], operator }],
selectedLabelList: [
{ value: labels[0], operator },
{ value: labels[1], operator },
],
});
await wrapper.vm.$nextTick();
expect(
......
......@@ -23,7 +23,11 @@ export const throughputChartNoData = {
export const formattedThroughputChartData = [
{
data: [['May 2020', 2], ['Jun 2020', 4], ['Jul 2020', 3]],
data: [
['May 2020', 2],
['Jun 2020', 4],
['Jul 2020', 3],
],
name: THROUGHPUT_CHART_STRINGS.Y_AXIS_TITLE,
},
];
......
......@@ -218,9 +218,7 @@ describe('ProductivityApp component', () => {
},
};
findMainMetricChart()
.find(GlColumnChart)
.vm.$emit('chartItemClicked', data);
findMainMetricChart().find(GlColumnChart).vm.$emit('chartItemClicked', data);
});
it('dispatches updateSelectedItems action', () => {
......@@ -410,11 +408,7 @@ describe('ProductivityApp component', () => {
});
it('renders a loading indicator', () => {
expect(
findMrTableSection()
.find(GlLoadingIcon)
.exists(),
).toBe(true);
expect(findMrTableSection().find(GlLoadingIcon).exists()).toBe(true);
});
});
......@@ -432,11 +426,7 @@ describe('ProductivityApp component', () => {
});
it('doesn’t render a "no data" message', () => {
expect(
findMrTableSection()
.find(GlAlert)
.exists(),
).toBe(false);
expect(findMrTableSection().find(GlAlert).exists()).toBe(false);
});
it('should change the column metric', async () => {
......@@ -459,10 +449,7 @@ describe('ProductivityApp component', () => {
});
it('should change the sort field', () => {
findSortFieldDropdown()
.findAll(GlDropdownItem)
.at(0)
.vm.$emit('click');
findSortFieldDropdown().findAll(GlDropdownItem).at(0).vm.$emit('click');
expect(tableActionSpies.setSortField).toHaveBeenCalled();
});
......@@ -483,11 +470,7 @@ describe('ProductivityApp component', () => {
});
it('renders a "no data" message', () => {
expect(
findMrTableSection()
.find(GlAlert)
.exists(),
).toBe(true);
expect(findMrTableSection().find(GlAlert).exists()).toBe(true);
});
it('doesn`t render the MR table', () => {
......
......@@ -140,9 +140,7 @@ describe('MetricChart component', () => {
it('should emit `metricTypeChange` event when dropdown item gets clicked', () => {
jest.spyOn(wrapper.vm, '$emit');
findMetricDropdownItems()
.at(0)
.vm.$emit('click');
findMetricDropdownItems().at(0).vm.$emit('click');
expect(wrapper.vm.$emit).toHaveBeenCalledWith('metricTypeChange', 'time_to_merge');
});
......@@ -151,12 +149,7 @@ describe('MetricChart component', () => {
wrapper.setProps({ selectedMetric: 'time_to_last_commit' });
return wrapper.vm.$nextTick().then(() => {
expect(
findMetricDropdownItems()
.at(0)
.find(GlIcon)
.classes(),
).toContain('invisible');
expect(findMetricDropdownItems().at(0).find(GlIcon).classes()).toContain('invisible');
});
});
});
......
......@@ -82,11 +82,9 @@ describe('MergeRequestTableRow component', () => {
});
it('renders the "Time to merge" metric column with the "days_to_merge" metric', () => {
expect(
findMetricColumns()
.at(0)
.props('value'),
).toBe(defaultProps.mergeRequest.days_to_merge);
expect(findMetricColumns().at(0).props('value')).toBe(
defaultProps.mergeRequest.days_to_merge,
);
});
});
});
......
......@@ -33,127 +33,127 @@ export const mockMergeRequests = [
];
export const mockHistogramData = {
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
'10': 10,
'11': 11,
'12': 12,
'13': 13,
'14': 14,
'15': 15,
'16': 16,
'17': 17,
'18': 18,
'19': 19,
'20': 20,
'21': 21,
'22': 22,
'23': 23,
'24': 24,
'25': 25,
'26': 26,
'27': 27,
'28': 28,
'29': 29,
'30': 30,
'31': 31,
'32': 32,
'33': 33,
'34': 34,
'35': 35,
'36': 36,
'37': 37,
'38': 38,
'39': 39,
'40': 40,
'41': 41,
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
10: 10,
11: 11,
12: 12,
13: 13,
14: 14,
15: 15,
16: 16,
17: 17,
18: 18,
19: 19,
20: 20,
21: 21,
22: 22,
23: 23,
24: 24,
25: 25,
26: 26,
27: 27,
28: 28,
29: 29,
30: 30,
31: 31,
32: 32,
33: 33,
34: 34,
35: 35,
36: 36,
37: 37,
38: 38,
39: 39,
40: 40,
41: 41,
};
export const mockScatterplotData = {
'1': {
1: {
metric: 139,
merged_at: '2019-08-18T22:00:00.000Z',
},
'2': {
2: {
metric: 138,
merged_at: '2019-08-17T22:00:00.000Z',
},
'3': {
3: {
metric: 24,
merged_at: '2019-08-16T22:00:00.000Z',
},
'4': {
4: {
metric: 56,
merged_at: '2019-08-15T22:00:00.000Z',
},
'5': {
5: {
metric: 46,
merged_at: '2019-08-14T22:00:00.000Z',
},
'6': {
6: {
metric: 43,
merged_at: '2019-08-13T22:00:00.000Z',
},
'7': {
7: {
metric: 60,
merged_at: '2019-08-12T22:00:00.000Z',
},
'8': {
8: {
metric: 62,
merged_at: '2019-08-11T22:00:00.000Z',
},
'9': {
9: {
metric: 46,
merged_at: '2019-08-10T22:00:00.000Z',
},
'10': {
10: {
metric: 44,
merged_at: '2019-08-09T22:00:00.000Z',
},
'11': {
11: {
metric: 57,
merged_at: '2019-08-08T22:00:00.000Z',
},
'12': {
12: {
metric: 51,
merged_at: '2019-08-07T22:00:00.000Z',
},
'13': {
13: {
metric: 54,
merged_at: '2019-08-06T22:00:00.000Z',
},
'14': {
14: {
metric: 64,
merged_at: '2019-08-05T22:00:00.000Z',
},
'15': {
15: {
metric: 52,
merged_at: '2019-08-04T22:00:00.000Z',
},
'16': {
16: {
metric: 56,
merged_at: '2019-08-03T22:00:00.000Z',
},
'17': {
17: {
metric: 47,
merged_at: '2019-08-02T22:00:00.000Z',
},
'18': {
18: {
metric: 49,
merged_at: '2019-08-01T22:00:00.000Z',
},
'19': {
19: {
metric: 46,
merged_at: '2019-07-31T22:00:00.000Z',
},
'20': {
20: {
metric: 57,
merged_at: '2019-07-30T22:00:00.000Z',
},
......
......@@ -41,8 +41,8 @@ describe('Productivity analytics chart getters', () => {
const chartKey = chartKeys.main;
state.charts[chartKey] = {
data: {
'1': 32,
'5': 17,
1: 32,
5: 17,
},
selected: ['5'],
};
......@@ -221,7 +221,7 @@ describe('Productivity analytics chart getters', () => {
describe(`does not exceed threshold of ${maxColumnChartItemsPerPage[chartKey]} items`, () => {
it('returns an empty dataZoom property', () => {
state.charts[chartKey].data = { '1': 1, '2': 2, '3': 3 };
state.charts[chartKey].data = { 1: 1, 2: 2, 3: 3 };
expect(getters.getColumnChartDatazoomOption(state)(chartKeys.main)).toEqual({});
});
......
......@@ -137,7 +137,11 @@ describe('Productivity Analytics utils', () => {
[{ merged_at: '2019-08-06T18:00:00.000Z', metric: 80 }],
];
const result = getMedianLineData(data, startDate, endDate, daysOffset);
const expected = [['2019-08-04', 45], ['2019-08-05', 55], ['2019-08-06', 65]];
const expected = [
['2019-08-04', 45],
['2019-08-05', 55],
['2019-08-06', 65],
];
expect(result).toEqual(expected);
});
});
......
......@@ -69,11 +69,9 @@ describe('Select projects dropdown component', () => {
selectAllProjects();
return wrapper.vm.$nextTick().then(() => {
expect(
findProjectById(initialData.groupProjects[0].id)
.find(GlIcon)
.classes(),
).toContain('gl-visibility-hidden');
expect(findProjectById(initialData.groupProjects[0].id).find(GlIcon).classes()).toContain(
'gl-visibility-hidden',
);
});
});
......@@ -104,11 +102,9 @@ describe('Select projects dropdown component', () => {
selectProjectById(project.id);
return wrapper.vm.$nextTick().then(() => {
expect(
findProjectById(project.id)
.find(GlIcon)
.classes(),
).not.toContain('gl-visibility-hidden');
expect(findProjectById(project.id).find(GlIcon).classes()).not.toContain(
'gl-visibility-hidden',
);
});
});
......@@ -116,11 +112,7 @@ describe('Select projects dropdown component', () => {
selectProjectById(initialData.groupProjects[0].id);
return wrapper.vm.$nextTick().then(() => {
expect(
findSelectAllProjects()
.find(GlIcon)
.classes(),
).toContain('gl-visibility-hidden');
expect(findSelectAllProjects().find(GlIcon).classes()).toContain('gl-visibility-hidden');
});
});
......
......@@ -180,16 +180,8 @@ describe('Test coverage table component', () => {
});
expect(findTable().exists()).toBe(true);
expect(
findTableRows()
.at(0)
.text(),
).toContain('should be first');
expect(
findTableRows()
.at(1)
.text(),
).toContain('should be last');
expect(findTableRows().at(0).text()).toContain('should be first');
expect(findTableRows().at(1).text()).toContain('should be last');
});
it('renders the correct link', async () => {
......
......@@ -75,11 +75,7 @@ describe('Daterange component', () => {
});
it('displays the correct number of selected days in the indicator', () => {
expect(
findDateRangeIndicator()
.find('span')
.text(),
).toBe('10 days');
expect(findDateRangeIndicator().find('span').text()).toBe('10 days');
});
});
});
......
......@@ -58,10 +58,7 @@ describe('GroupsDropdownFilter component', () => {
expect(dropdown.find('div.gl-avatar-identicon').exists()).toBe(hasIdenticon);
};
const selectDropdownAtIndex = index =>
findDropdownAtIndex(index)
.find('button')
.trigger('click');
const selectDropdownAtIndex = index => findDropdownAtIndex(index).find('button').trigger('click');
describe('when passed a defaultGroup as prop', () => {
beforeEach(() => {
......@@ -130,16 +127,8 @@ describe('GroupsDropdownFilter component', () => {
selectDropdownAtIndex(1);
return wrapper.vm.$nextTick().then(() => {
expect(
findDropdownButton()
.find('img.gl-avatar')
.exists(),
).toBe(false);
expect(
findDropdownButton()
.find('.gl-avatar-identicon')
.exists(),
).toBe(true);
expect(findDropdownButton().find('img.gl-avatar').exists()).toBe(false);
expect(findDropdownButton().find('.gl-avatar-identicon').exists()).toBe(true);
});
});
});
......
......@@ -75,9 +75,7 @@ describe('ProjectsDropdownFilter component', () => {
findDropdownAtIndex(index).find('[data-testid="project-full-path"]');
const selectDropdownItemAtIndex = index =>
findDropdownAtIndex(index)
.find('button')
.trigger('click');
findDropdownAtIndex(index).find('button').trigger('click');
describe('queryParams are applied when fetching data', () => {
beforeEach(() => {
......
......@@ -292,7 +292,10 @@ describe('Api', () => {
describe('cycleAnalyticsSummaryData', () => {
it('fetches value stream analytics summary data', done => {
const response = [{ value: 0, title: 'New Issues' }, { value: 0, title: 'Deploys' }];
const response = [
{ value: 0, title: 'New Issues' },
{ value: 0, title: 'Deploys' },
];
const params = { ...defaultParams };
const expectedUrl = `${dummyValueStreamAnalyticsUrlRoot}/summary`;
mock.onGet(expectedUrl).reply(httpStatus.OK, response);
......@@ -631,7 +634,10 @@ describe('Api', () => {
describe('getGeoReplicableItems', () => {
it('fetches replicableItems based on replicableType', () => {
apiResponse = [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }];
apiResponse = [
{ id: 1, name: 'foo' },
{ id: 2, name: 'bar' },
];
mockParams = { page: 1 };
jest.spyOn(Api, 'buildUrl').mockReturnValue(expectedUrl);
......
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