Commit 4ab9b3ea authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch 'leipert-upgrade-prettier-spec' into 'master'

Upgrade spec folders to prettier v2

See merge request gitlab-org/gitlab!50470
parents 5b89a956 ed94bf25
...@@ -9,137 +9,3 @@ doc/api/graphql/reference/gitlab_schema.graphql ...@@ -9,137 +9,3 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.css *.css
*.scss *.scss
*.md *.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
ee/spec/frontend/boards/components
ee/spec/frontend/boards/stores
ee/spec/frontend/burndown_chart
ee/spec/frontend/compliance_dashboard/components/merge_requests
ee/spec/frontend/dependencies/components
ee/spec/frontend/epic/store
ee/spec/frontend/geo_nodes/components
ee/spec/frontend/geo_replicable/components
ee/spec/frontend/groups/components
ee/spec/frontend/groups/settings/
ee/spec/frontend/incidents/components
ee/spec/frontend/insights
ee/spec/frontend/issuable/related_issues/components
ee/spec/frontend/issues_analytics/components
ee/spec/frontend/iterations/components
ee/spec/frontend/license_compliance/components
ee/spec/frontend/members/components/ldap
ee/spec/frontend/on_demand_scans/components/profile_selector
ee/spec/frontend/oncall_schedule
ee/spec/frontend/pages/admin/users
ee/spec/frontend/related_items_tree/components
ee/spec/frontend/related_items_tree/store
ee/spec/frontend/roadmap/components
ee/spec/frontend/security_configuration/components
ee/spec/frontend/security_configuration/dast_scanner_profiles_form/components
ee/spec/frontend/security_configuration/sast/components
ee/spec/frontend/security_dashboard/components
ee/spec/frontend/security_dashboard/store/modules/project_selector
ee/spec/frontend/sidebar/components
ee/spec/frontend/storage_counter/components
ee/spec/frontend/subscriptions/new/components
ee/spec/frontend/threat_monitoring
ee/spec/frontend/vue_mr_widget
ee/spec/frontend/vue_shared/components/sidebar/epics_select
ee/spec/frontend/vue_shared/license_compliance/components
ee/spec/frontend/vue_shared/license_compliance/store
ee/spec/frontend/vue_shared/security_reports/components
ee/spec/frontend/vulnerabilities
spec/frontend/alert_management/components
spec/frontend/alerts_settings
spec/frontend/authentication/u2f
spec/frontend/badges/components
spec/frontend/badges/store
spec/frontend/batch_comments/components
spec/frontend/behaviors
spec/frontend/blob/components
spec/frontend/boards
spec/frontend/ci_settings_pipeline_triggers/components
spec/frontend/ci_variable_list/ci_variable_list
spec/frontend/create_cluster/components
spec/frontend/create_cluster/eks_cluster/services
spec/frontend/deploy_freeze/components
spec/frontend/deploy_keys/components
spec/frontend/design_management/components/design_notes
spec/frontend/design_management/pages
spec/frontend/diffs/components
spec/frontend/diffs/store
spec/frontend/error_tracking/components
spec/frontend/error_tracking/store/list
spec/frontend/error_tracking_settings/components
spec/frontend/feature_flags/components
spec/frontend/filtered_search/components
spec/frontend/groups/components
spec/frontend/helpers
spec/frontend/ide/components
spec/frontend/ide/lib
spec/frontend/ide/stores
spec/frontend/incidents/components
spec/frontend/incidents_settings/components
spec/frontend/integrations/edit/components
spec/frontend/issuable/related_issues/components
spec/frontend/issuable_list/components
spec/frontend/issuable_show/components
spec/frontend/issuable_suggestions/components
spec/frontend/issue_show/components
spec/frontend/issues_list/components
spec/frontend/jobs/components
spec/frontend/lib/utils
spec/frontend/logs/components
spec/frontend/members/components/action_buttons
spec/frontend/members/components/filter_sort
spec/frontend/members/components/table
spec/frontend/milestones
spec/frontend/monitoring
spec/frontend/notes
spec/frontend/packages/details/components
spec/frontend/packages/details/store
spec/frontend/packages/list/stores
spec/frontend/packages/shared/components
spec/frontend/pages/projects/forks/new/components
spec/frontend/pages/projects/pipeline_schedules/shared/components
spec/frontend/pages/projects/shared/permissions/components
spec/frontend/pages/search/show
spec/frontend/pages/sessions/new
spec/frontend/pipeline_editor
spec/frontend/pipeline_editor/components/lint
spec/frontend/pipeline_new/components
spec/frontend/pipelines
spec/frontend/profile/account/components
spec/frontend/projects
spec/frontend/prometheus_metrics
spec/frontend/ref/components
spec/frontend/registry/explorer/components
spec/frontend/registry/settings
spec/frontend/related_merge_requests/components
spec/frontend/releases/components
spec/frontend/reports/codequality_report
spec/frontend/reports/components
spec/frontend/repository/components
spec/frontend/self_monitor/components
spec/frontend/serverless
spec/frontend/sidebar
spec/frontend/snippets/components
spec/frontend/vue_mr_widget
spec/frontend/vue_shared/components
spec/frontend/vue_shared/directives
spec/frontend_integration/ide/helpers
spec/frontend_integration/test_helpers/factories
spec/frontend_integration/test_helpers/utils
spec/javascripts
...@@ -34,10 +34,7 @@ describe('DevopsAdoptionTable', () => { ...@@ -34,10 +34,7 @@ describe('DevopsAdoptionTable', () => {
const findCol = testId => findTable().find(`[data-testid="${testId}"]`); const findCol = testId => findTable().find(`[data-testid="${testId}"]`);
const findColRowChild = (col, row, child) => const findColRowChild = (col, row, child) =>
findTable() findTable().findAll(`[data-testid="${col}"]`).at(row).find(child);
.findAll(`[data-testid="${col}"]`)
.at(row)
.find(child);
const findColSubComponent = (colTestId, childComponent) => const findColSubComponent = (colTestId, childComponent) =>
findCol(colTestId).find(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 = { export const pageData = {
'x-next-page': 2, 'x-next-page': 2,
...@@ -17,7 +20,10 @@ export const groupNodes = [ ...@@ -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']; export const groupIds = ['1', '2'];
......
...@@ -41,14 +41,8 @@ describe('MergeRequestTable component', () => { ...@@ -41,14 +41,8 @@ describe('MergeRequestTable component', () => {
}); });
const findTable = () => wrapper.find(GlTable); const findTable = () => wrapper.find(GlTable);
const findTableRow = index => const findTableRow = index => findTable().findAll('tbody tr').at(index);
findTable() const findReviewTimeCol = rowIndex => findTableRow(rowIndex).findAll('td').at(1);
.findAll('tbody tr')
.at(index);
const findReviewTimeCol = rowIndex =>
findTableRow(rowIndex)
.findAll('td')
.at(1);
const updateMergeRequests = (index, attrs) => const updateMergeRequests = (index, attrs) =>
mockMergeRequests.map((item, idx) => { mockMergeRequests.map((item, idx) => {
......
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import Component from 'ee/analytics/contribution_analytics/components/column_chart.vue'; 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', () => { describe('Contribution Analytics Column Chart', () => {
let wrapper; let wrapper;
......
...@@ -153,10 +153,7 @@ describe('Value Stream Analytics component', () => { ...@@ -153,10 +153,7 @@ describe('Value Stream Analytics component', () => {
} }
const findStageNavItemAtIndex = index => const findStageNavItemAtIndex = index =>
wrapper wrapper.find(StageTableNav).findAll(StageNavItem).at(index);
.find(StageTableNav)
.findAll(StageNavItem)
.at(index);
const findAddStageButton = () => wrapper.find(AddStageButton); const findAddStageButton = () => wrapper.find(AddStageButton);
......
...@@ -415,9 +415,7 @@ describe('CustomStageForm', () => { ...@@ -415,9 +415,7 @@ describe('CustomStageForm', () => {
}); });
it(`emits the ${STAGE_ACTIONS.UPDATE} action when clicking on a stage to recover`, async () => { it(`emits the ${STAGE_ACTIONS.UPDATE} action when clicking on a stage to recover`, async () => {
findRecoverStageDropdown() findRecoverStageDropdown().find(GlDropdownItem).vm.$emit('click');
.find(GlDropdownItem)
.vm.$emit('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.emitted()).toEqual({ expect(wrapper.emitted()).toEqual({
......
...@@ -65,10 +65,7 @@ describe('DurationChart', () => { ...@@ -65,10 +65,7 @@ describe('DurationChart', () => {
const findLoader = _wrapper => _wrapper.find(ChartSkeletonLoader); const findLoader = _wrapper => _wrapper.find(ChartSkeletonLoader);
const selectStage = (_wrapper, index = 0) => { const selectStage = (_wrapper, index = 0) => {
findStageDropdown(_wrapper) findStageDropdown(_wrapper).findAll(GlDropdownItem).at(index).vm.$emit('click');
.findAll(GlDropdownItem)
.at(index)
.vm.$emit('click');
}; };
beforeEach(() => { beforeEach(() => {
......
...@@ -186,13 +186,19 @@ describe('Filter bar', () => { ...@@ -186,13 +186,19 @@ describe('Filter bar', () => {
[ [
'selectedLabelList', 'selectedLabelList',
'label_name', 'label_name',
[{ value: 'Afternix', operator: '=' }, { value: 'Brouceforge', operator: '=' }], [
{ value: 'Afternix', operator: '=' },
{ value: 'Brouceforge', operator: '=' },
],
['Afternix', 'Brouceforge'], ['Afternix', 'Brouceforge'],
], ],
[ [
'selectedAssigneeList', 'selectedAssigneeList',
'assignee_username', 'assignee_username',
[{ value: 'rootUser', operator: '=' }, { value: 'secondaryUser', operator: '=' }], [
{ value: 'rootUser', operator: '=' },
{ value: 'secondaryUser', operator: '=' },
],
['rootUser', 'secondaryUser'], ['rootUser', 'secondaryUser'],
], ],
])('with a %s updates the %s url parameter', (stateKey, paramKey, payload, result) => { ])('with a %s updates the %s url parameter', (stateKey, paramKey, payload, result) => {
......
...@@ -22,9 +22,7 @@ describe('PathNavigation', () => { ...@@ -22,9 +22,7 @@ describe('PathNavigation', () => {
}; };
const clickItemAt = index => { const clickItemAt = index => {
pathNavigationItems() pathNavigationItems().at(index).trigger('click');
.at(index)
.trigger('click');
}; };
beforeEach(() => { beforeEach(() => {
......
...@@ -39,10 +39,7 @@ describe('StageDropdownFilter component', () => { ...@@ -39,10 +39,7 @@ describe('StageDropdownFilter component', () => {
const findDropdown = () => wrapper.find(GlDropdown); const findDropdown = () => wrapper.find(GlDropdown);
const selectDropdownItemAtIndex = index => const selectDropdownItemAtIndex = index =>
findDropdown() findDropdown().findAll(GlDropdownItem).at(index).vm.$emit('click');
.findAll(GlDropdownItem)
.at(index)
.vm.$emit('click');
describe('on stage click', () => { describe('on stage click', () => {
describe('clicking a selected stage', () => { describe('clicking a selected stage', () => {
......
...@@ -27,10 +27,7 @@ describe('StageTableNav', () => { ...@@ -27,10 +27,7 @@ describe('StageTableNav', () => {
}); });
function selectStage(index) { function selectStage(index) {
wrapper wrapper.findAll(StageNavItem).at(index).trigger('click');
.findAll(StageNavItem)
.at(index)
.trigger('click');
} }
describe('when a stage is clicked', () => { describe('when a stage is clicked', () => {
......
...@@ -23,9 +23,7 @@ const findSelectedSubjectFilters = ctx => findSubjectFilters(ctx).attributes('ch ...@@ -23,9 +23,7 @@ const findSelectedSubjectFilters = ctx => findSubjectFilters(ctx).attributes('ch
const findDropdownLabels = ctx => ctx.find(LabelsSelector).findAll(GlDropdownItem); const findDropdownLabels = ctx => ctx.find(LabelsSelector).findAll(GlDropdownItem);
const selectLabelAtIndex = (ctx, index) => { const selectLabelAtIndex = (ctx, index) => {
findDropdownLabels(ctx) findDropdownLabels(ctx).at(index).trigger('click');
.at(index)
.trigger('click');
return waitForPromises(); return waitForPromises();
}; };
...@@ -189,10 +187,7 @@ describe('TasksByTypeFilters', () => { ...@@ -189,10 +187,7 @@ describe('TasksByTypeFilters', () => {
wrapper = createComponent({ mountFn: mount }); wrapper = createComponent({ mountFn: mount });
expect(wrapper.emitted('updateFilter')).toBeUndefined(); expect(wrapper.emitted('updateFilter')).toBeUndefined();
findSubjectFilters(wrapper) findSubjectFilters(wrapper).findAll('label:not(.active)').at(0).trigger('click');
.findAll('label:not(.active)')
.at(0)
.trigger('click');
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.emitted('updateFilter')).toBeDefined(); expect(wrapper.emitted('updateFilter')).toBeDefined();
......
...@@ -38,7 +38,10 @@ export const endpoints = { ...@@ -38,7 +38,10 @@ export const endpoints = {
valueStreamData: /analytics\/value_stream_analytics\/value_streams/, 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( export const groupLabels = getJSONFixture(fixtureEndpoints.groupLabels).map(
convertObjectPropsToCamelCase, convertObjectPropsToCamelCase,
...@@ -184,7 +187,11 @@ export const transformedStagePathData = transformStagesForPathNavigation({ ...@@ -184,7 +187,11 @@ export const transformedStagePathData = transformStagesForPathNavigation({
export const tasksByTypeData = { export const tasksByTypeData = {
seriesNames: ['Cool label', 'Normal label'], 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'], groupBy: ['Group 1', 'Group 2', 'Group 3'],
}; };
......
...@@ -160,8 +160,8 @@ describe('Value Stream Analytics mutations', () => { ...@@ -160,8 +160,8 @@ describe('Value Stream Analytics mutations', () => {
]); ]);
expect(stateWithData.medians).toEqual({ expect(stateWithData.medians).toEqual({
'1': { value: 20, error: null }, 1: { value: 20, error: null },
'2': { value: 10, error: null }, 2: { value: 10, error: null },
}); });
}); });
}); });
......
...@@ -206,7 +206,10 @@ describe('ThroughputChart', () => { ...@@ -206,7 +206,10 @@ describe('ThroughputChart', () => {
selectedAssignee: { value: assigneeUsername, operator }, selectedAssignee: { value: assigneeUsername, operator },
selectedAuthor: { value: authorUsername, operator }, selectedAuthor: { value: authorUsername, operator },
selectedMilestone: { value: milestoneTitle, 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(); await wrapper.vm.$nextTick();
expect( expect(
......
...@@ -78,15 +78,9 @@ describe('ThroughputTable', () => { ...@@ -78,15 +78,9 @@ describe('ThroughputTable', () => {
const findPagination = () => wrapper.find(GlPagination); const findPagination = () => wrapper.find(GlPagination);
const findPrevious = () => const findPrevious = () => findPagination().findAll('.page-item').at(0);
findPagination()
.findAll('.page-item')
.at(0);
const findNext = () => const findNext = () => findPagination().findAll('.page-item').at(1);
findPagination()
.findAll('.page-item')
.at(1);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -472,7 +466,10 @@ describe('ThroughputTable', () => { ...@@ -472,7 +466,10 @@ describe('ThroughputTable', () => {
selectedAssignee: { value: assigneeUsername, operator }, selectedAssignee: { value: assigneeUsername, operator },
selectedAuthor: { value: authorUsername, operator }, selectedAuthor: { value: authorUsername, operator },
selectedMilestone: { value: milestoneTitle, 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(); await wrapper.vm.$nextTick();
expect( expect(
......
...@@ -23,7 +23,11 @@ export const throughputChartNoData = { ...@@ -23,7 +23,11 @@ export const throughputChartNoData = {
export const formattedThroughputChartData = [ 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, name: THROUGHPUT_CHART_STRINGS.Y_AXIS_TITLE,
}, },
]; ];
......
...@@ -218,9 +218,7 @@ describe('ProductivityApp component', () => { ...@@ -218,9 +218,7 @@ describe('ProductivityApp component', () => {
}, },
}; };
findMainMetricChart() findMainMetricChart().find(GlColumnChart).vm.$emit('chartItemClicked', data);
.find(GlColumnChart)
.vm.$emit('chartItemClicked', data);
}); });
it('dispatches updateSelectedItems action', () => { it('dispatches updateSelectedItems action', () => {
...@@ -410,11 +408,7 @@ describe('ProductivityApp component', () => { ...@@ -410,11 +408,7 @@ describe('ProductivityApp component', () => {
}); });
it('renders a loading indicator', () => { it('renders a loading indicator', () => {
expect( expect(findMrTableSection().find(GlLoadingIcon).exists()).toBe(true);
findMrTableSection()
.find(GlLoadingIcon)
.exists(),
).toBe(true);
}); });
}); });
...@@ -432,11 +426,7 @@ describe('ProductivityApp component', () => { ...@@ -432,11 +426,7 @@ describe('ProductivityApp component', () => {
}); });
it('doesn’t render a "no data" message', () => { it('doesn’t render a "no data" message', () => {
expect( expect(findMrTableSection().find(GlAlert).exists()).toBe(false);
findMrTableSection()
.find(GlAlert)
.exists(),
).toBe(false);
}); });
it('should change the column metric', async () => { it('should change the column metric', async () => {
...@@ -459,10 +449,7 @@ describe('ProductivityApp component', () => { ...@@ -459,10 +449,7 @@ describe('ProductivityApp component', () => {
}); });
it('should change the sort field', () => { it('should change the sort field', () => {
findSortFieldDropdown() findSortFieldDropdown().findAll(GlDropdownItem).at(0).vm.$emit('click');
.findAll(GlDropdownItem)
.at(0)
.vm.$emit('click');
expect(tableActionSpies.setSortField).toHaveBeenCalled(); expect(tableActionSpies.setSortField).toHaveBeenCalled();
}); });
...@@ -483,11 +470,7 @@ describe('ProductivityApp component', () => { ...@@ -483,11 +470,7 @@ describe('ProductivityApp component', () => {
}); });
it('renders a "no data" message', () => { it('renders a "no data" message', () => {
expect( expect(findMrTableSection().find(GlAlert).exists()).toBe(true);
findMrTableSection()
.find(GlAlert)
.exists(),
).toBe(true);
}); });
it('doesn`t render the MR table', () => { it('doesn`t render the MR table', () => {
......
...@@ -140,9 +140,7 @@ describe('MetricChart component', () => { ...@@ -140,9 +140,7 @@ describe('MetricChart component', () => {
it('should emit `metricTypeChange` event when dropdown item gets clicked', () => { it('should emit `metricTypeChange` event when dropdown item gets clicked', () => {
jest.spyOn(wrapper.vm, '$emit'); jest.spyOn(wrapper.vm, '$emit');
findMetricDropdownItems() findMetricDropdownItems().at(0).vm.$emit('click');
.at(0)
.vm.$emit('click');
expect(wrapper.vm.$emit).toHaveBeenCalledWith('metricTypeChange', 'time_to_merge'); expect(wrapper.vm.$emit).toHaveBeenCalledWith('metricTypeChange', 'time_to_merge');
}); });
...@@ -151,12 +149,7 @@ describe('MetricChart component', () => { ...@@ -151,12 +149,7 @@ describe('MetricChart component', () => {
wrapper.setProps({ selectedMetric: 'time_to_last_commit' }); wrapper.setProps({ selectedMetric: 'time_to_last_commit' });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(findMetricDropdownItems().at(0).find(GlIcon).classes()).toContain('invisible');
findMetricDropdownItems()
.at(0)
.find(GlIcon)
.classes(),
).toContain('invisible');
}); });
}); });
}); });
......
...@@ -82,11 +82,9 @@ describe('MergeRequestTableRow component', () => { ...@@ -82,11 +82,9 @@ describe('MergeRequestTableRow component', () => {
}); });
it('renders the "Time to merge" metric column with the "days_to_merge" metric', () => { it('renders the "Time to merge" metric column with the "days_to_merge" metric', () => {
expect( expect(findMetricColumns().at(0).props('value')).toBe(
findMetricColumns() defaultProps.mergeRequest.days_to_merge,
.at(0) );
.props('value'),
).toBe(defaultProps.mergeRequest.days_to_merge);
}); });
}); });
}); });
......
...@@ -33,127 +33,127 @@ export const mockMergeRequests = [ ...@@ -33,127 +33,127 @@ export const mockMergeRequests = [
]; ];
export const mockHistogramData = { export const mockHistogramData = {
'1': 1, 1: 1,
'2': 2, 2: 2,
'3': 3, 3: 3,
'4': 4, 4: 4,
'5': 5, 5: 5,
'6': 6, 6: 6,
'7': 7, 7: 7,
'8': 8, 8: 8,
'9': 9, 9: 9,
'10': 10, 10: 10,
'11': 11, 11: 11,
'12': 12, 12: 12,
'13': 13, 13: 13,
'14': 14, 14: 14,
'15': 15, 15: 15,
'16': 16, 16: 16,
'17': 17, 17: 17,
'18': 18, 18: 18,
'19': 19, 19: 19,
'20': 20, 20: 20,
'21': 21, 21: 21,
'22': 22, 22: 22,
'23': 23, 23: 23,
'24': 24, 24: 24,
'25': 25, 25: 25,
'26': 26, 26: 26,
'27': 27, 27: 27,
'28': 28, 28: 28,
'29': 29, 29: 29,
'30': 30, 30: 30,
'31': 31, 31: 31,
'32': 32, 32: 32,
'33': 33, 33: 33,
'34': 34, 34: 34,
'35': 35, 35: 35,
'36': 36, 36: 36,
'37': 37, 37: 37,
'38': 38, 38: 38,
'39': 39, 39: 39,
'40': 40, 40: 40,
'41': 41, 41: 41,
}; };
export const mockScatterplotData = { export const mockScatterplotData = {
'1': { 1: {
metric: 139, metric: 139,
merged_at: '2019-08-18T22:00:00.000Z', merged_at: '2019-08-18T22:00:00.000Z',
}, },
'2': { 2: {
metric: 138, metric: 138,
merged_at: '2019-08-17T22:00:00.000Z', merged_at: '2019-08-17T22:00:00.000Z',
}, },
'3': { 3: {
metric: 24, metric: 24,
merged_at: '2019-08-16T22:00:00.000Z', merged_at: '2019-08-16T22:00:00.000Z',
}, },
'4': { 4: {
metric: 56, metric: 56,
merged_at: '2019-08-15T22:00:00.000Z', merged_at: '2019-08-15T22:00:00.000Z',
}, },
'5': { 5: {
metric: 46, metric: 46,
merged_at: '2019-08-14T22:00:00.000Z', merged_at: '2019-08-14T22:00:00.000Z',
}, },
'6': { 6: {
metric: 43, metric: 43,
merged_at: '2019-08-13T22:00:00.000Z', merged_at: '2019-08-13T22:00:00.000Z',
}, },
'7': { 7: {
metric: 60, metric: 60,
merged_at: '2019-08-12T22:00:00.000Z', merged_at: '2019-08-12T22:00:00.000Z',
}, },
'8': { 8: {
metric: 62, metric: 62,
merged_at: '2019-08-11T22:00:00.000Z', merged_at: '2019-08-11T22:00:00.000Z',
}, },
'9': { 9: {
metric: 46, metric: 46,
merged_at: '2019-08-10T22:00:00.000Z', merged_at: '2019-08-10T22:00:00.000Z',
}, },
'10': { 10: {
metric: 44, metric: 44,
merged_at: '2019-08-09T22:00:00.000Z', merged_at: '2019-08-09T22:00:00.000Z',
}, },
'11': { 11: {
metric: 57, metric: 57,
merged_at: '2019-08-08T22:00:00.000Z', merged_at: '2019-08-08T22:00:00.000Z',
}, },
'12': { 12: {
metric: 51, metric: 51,
merged_at: '2019-08-07T22:00:00.000Z', merged_at: '2019-08-07T22:00:00.000Z',
}, },
'13': { 13: {
metric: 54, metric: 54,
merged_at: '2019-08-06T22:00:00.000Z', merged_at: '2019-08-06T22:00:00.000Z',
}, },
'14': { 14: {
metric: 64, metric: 64,
merged_at: '2019-08-05T22:00:00.000Z', merged_at: '2019-08-05T22:00:00.000Z',
}, },
'15': { 15: {
metric: 52, metric: 52,
merged_at: '2019-08-04T22:00:00.000Z', merged_at: '2019-08-04T22:00:00.000Z',
}, },
'16': { 16: {
metric: 56, metric: 56,
merged_at: '2019-08-03T22:00:00.000Z', merged_at: '2019-08-03T22:00:00.000Z',
}, },
'17': { 17: {
metric: 47, metric: 47,
merged_at: '2019-08-02T22:00:00.000Z', merged_at: '2019-08-02T22:00:00.000Z',
}, },
'18': { 18: {
metric: 49, metric: 49,
merged_at: '2019-08-01T22:00:00.000Z', merged_at: '2019-08-01T22:00:00.000Z',
}, },
'19': { 19: {
metric: 46, metric: 46,
merged_at: '2019-07-31T22:00:00.000Z', merged_at: '2019-07-31T22:00:00.000Z',
}, },
'20': { 20: {
metric: 57, metric: 57,
merged_at: '2019-07-30T22:00:00.000Z', merged_at: '2019-07-30T22:00:00.000Z',
}, },
......
...@@ -41,8 +41,8 @@ describe('Productivity analytics chart getters', () => { ...@@ -41,8 +41,8 @@ describe('Productivity analytics chart getters', () => {
const chartKey = chartKeys.main; const chartKey = chartKeys.main;
state.charts[chartKey] = { state.charts[chartKey] = {
data: { data: {
'1': 32, 1: 32,
'5': 17, 5: 17,
}, },
selected: ['5'], selected: ['5'],
}; };
...@@ -221,7 +221,7 @@ describe('Productivity analytics chart getters', () => { ...@@ -221,7 +221,7 @@ describe('Productivity analytics chart getters', () => {
describe(`does not exceed threshold of ${maxColumnChartItemsPerPage[chartKey]} items`, () => { describe(`does not exceed threshold of ${maxColumnChartItemsPerPage[chartKey]} items`, () => {
it('returns an empty dataZoom property', () => { 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({}); expect(getters.getColumnChartDatazoomOption(state)(chartKeys.main)).toEqual({});
}); });
......
...@@ -137,7 +137,11 @@ describe('Productivity Analytics utils', () => { ...@@ -137,7 +137,11 @@ describe('Productivity Analytics utils', () => {
[{ merged_at: '2019-08-06T18:00:00.000Z', metric: 80 }], [{ merged_at: '2019-08-06T18:00:00.000Z', metric: 80 }],
]; ];
const result = getMedianLineData(data, startDate, endDate, daysOffset); 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); expect(result).toEqual(expected);
}); });
}); });
......
...@@ -69,11 +69,9 @@ describe('Select projects dropdown component', () => { ...@@ -69,11 +69,9 @@ describe('Select projects dropdown component', () => {
selectAllProjects(); selectAllProjects();
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(findProjectById(initialData.groupProjects[0].id).find(GlIcon).classes()).toContain(
findProjectById(initialData.groupProjects[0].id) 'gl-visibility-hidden',
.find(GlIcon) );
.classes(),
).toContain('gl-visibility-hidden');
}); });
}); });
...@@ -104,11 +102,9 @@ describe('Select projects dropdown component', () => { ...@@ -104,11 +102,9 @@ describe('Select projects dropdown component', () => {
selectProjectById(project.id); selectProjectById(project.id);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(findProjectById(project.id).find(GlIcon).classes()).not.toContain(
findProjectById(project.id) 'gl-visibility-hidden',
.find(GlIcon) );
.classes(),
).not.toContain('gl-visibility-hidden');
}); });
}); });
...@@ -116,11 +112,7 @@ describe('Select projects dropdown component', () => { ...@@ -116,11 +112,7 @@ describe('Select projects dropdown component', () => {
selectProjectById(initialData.groupProjects[0].id); selectProjectById(initialData.groupProjects[0].id);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(findSelectAllProjects().find(GlIcon).classes()).toContain('gl-visibility-hidden');
findSelectAllProjects()
.find(GlIcon)
.classes(),
).toContain('gl-visibility-hidden');
}); });
}); });
......
...@@ -180,16 +180,8 @@ describe('Test coverage table component', () => { ...@@ -180,16 +180,8 @@ describe('Test coverage table component', () => {
}); });
expect(findTable().exists()).toBe(true); expect(findTable().exists()).toBe(true);
expect( expect(findTableRows().at(0).text()).toContain('should be first');
findTableRows() expect(findTableRows().at(1).text()).toContain('should be last');
.at(0)
.text(),
).toContain('should be first');
expect(
findTableRows()
.at(1)
.text(),
).toContain('should be last');
}); });
it('renders the correct link', async () => { it('renders the correct link', async () => {
......
...@@ -75,11 +75,7 @@ describe('Daterange component', () => { ...@@ -75,11 +75,7 @@ describe('Daterange component', () => {
}); });
it('displays the correct number of selected days in the indicator', () => { it('displays the correct number of selected days in the indicator', () => {
expect( expect(findDateRangeIndicator().find('span').text()).toBe('10 days');
findDateRangeIndicator()
.find('span')
.text(),
).toBe('10 days');
}); });
}); });
}); });
......
...@@ -58,10 +58,7 @@ describe('GroupsDropdownFilter component', () => { ...@@ -58,10 +58,7 @@ describe('GroupsDropdownFilter component', () => {
expect(dropdown.find('div.gl-avatar-identicon').exists()).toBe(hasIdenticon); expect(dropdown.find('div.gl-avatar-identicon').exists()).toBe(hasIdenticon);
}; };
const selectDropdownAtIndex = index => const selectDropdownAtIndex = index => findDropdownAtIndex(index).find('button').trigger('click');
findDropdownAtIndex(index)
.find('button')
.trigger('click');
describe('when passed a defaultGroup as prop', () => { describe('when passed a defaultGroup as prop', () => {
beforeEach(() => { beforeEach(() => {
...@@ -130,16 +127,8 @@ describe('GroupsDropdownFilter component', () => { ...@@ -130,16 +127,8 @@ describe('GroupsDropdownFilter component', () => {
selectDropdownAtIndex(1); selectDropdownAtIndex(1);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(findDropdownButton().find('img.gl-avatar').exists()).toBe(false);
findDropdownButton() expect(findDropdownButton().find('.gl-avatar-identicon').exists()).toBe(true);
.find('img.gl-avatar')
.exists(),
).toBe(false);
expect(
findDropdownButton()
.find('.gl-avatar-identicon')
.exists(),
).toBe(true);
}); });
}); });
}); });
......
...@@ -75,9 +75,7 @@ describe('ProjectsDropdownFilter component', () => { ...@@ -75,9 +75,7 @@ describe('ProjectsDropdownFilter component', () => {
findDropdownAtIndex(index).find('[data-testid="project-full-path"]'); findDropdownAtIndex(index).find('[data-testid="project-full-path"]');
const selectDropdownItemAtIndex = index => const selectDropdownItemAtIndex = index =>
findDropdownAtIndex(index) findDropdownAtIndex(index).find('button').trigger('click');
.find('button')
.trigger('click');
describe('queryParams are applied when fetching data', () => { describe('queryParams are applied when fetching data', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -292,7 +292,10 @@ describe('Api', () => { ...@@ -292,7 +292,10 @@ describe('Api', () => {
describe('cycleAnalyticsSummaryData', () => { 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' }]; const response = [
{ value: 0, title: 'New Issues' },
{ value: 0, title: 'Deploys' },
];
const params = { ...defaultParams }; const params = { ...defaultParams };
const expectedUrl = `${dummyValueStreamAnalyticsUrlRoot}/summary`; const expectedUrl = `${dummyValueStreamAnalyticsUrlRoot}/summary`;
mock.onGet(expectedUrl).reply(httpStatus.OK, response); mock.onGet(expectedUrl).reply(httpStatus.OK, response);
...@@ -631,7 +634,10 @@ describe('Api', () => { ...@@ -631,7 +634,10 @@ describe('Api', () => {
describe('getGeoReplicableItems', () => { describe('getGeoReplicableItems', () => {
it('fetches replicableItems based on replicableType', () => { 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 }; mockParams = { page: 1 };
jest.spyOn(Api, 'buildUrl').mockReturnValue(expectedUrl); jest.spyOn(Api, 'buildUrl').mockReturnValue(expectedUrl);
......
...@@ -216,10 +216,9 @@ describe('EE Approvals App', () => { ...@@ -216,10 +216,9 @@ describe('EE Approvals App', () => {
findResetButton().vm.$emit('click'); findResetButton().vm.$emit('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(store.modules.approvals.actions.fetchRules).toHaveBeenLastCalledWith( expect(
expect.anything(), store.modules.approvals.actions.fetchRules,
{ targetBranch, resetToDefault: true }, ).toHaveBeenLastCalledWith(expect.anything(), { targetBranch, resetToDefault: true });
);
expect(showToast).toHaveBeenCalledWith('Approval rules reset to project defaults', { expect(showToast).toHaveBeenCalledWith('Approval rules reset to project defaults', {
action: { action: {
text: 'Undo', text: 'Undo',
......
...@@ -25,23 +25,13 @@ describe('Approval Check Popover', () => { ...@@ -25,23 +25,13 @@ describe('Approval Check Popover', () => {
}); });
it('should render the documentation link', () => { it('should render the documentation link', () => {
expect( expect(wrapper.find(GlPopover).find(GlLink).attributes('href')).toBe(documentationLink);
wrapper
.find(GlPopover)
.find(GlLink)
.attributes('href'),
).toBe(documentationLink);
}); });
}); });
describe('without a documentation link', () => { describe('without a documentation link', () => {
it('should not render the documentation link', () => { it('should not render the documentation link', () => {
expect( expect(wrapper.find(GlPopover).find(GlLink).exists()).toBeFalsy();
wrapper
.find(GlPopover)
.find(GlLink)
.exists(),
).toBeFalsy();
}); });
}); });
}); });
...@@ -7,7 +7,10 @@ import BranchesSelect from 'ee/approvals/components/branches_select.vue'; ...@@ -7,7 +7,10 @@ import BranchesSelect from 'ee/approvals/components/branches_select.vue';
const TEST_DEFAULT_BRANCH = { name: 'Any branch' }; const TEST_DEFAULT_BRANCH = { name: 'Any branch' };
const TEST_PROJECT_ID = '1'; const TEST_PROJECT_ID = '1';
const TEST_PROTECTED_BRANCHES = [{ id: 1, name: 'master' }, { id: 2, name: 'development' }]; const TEST_PROTECTED_BRANCHES = [
{ id: 1, name: 'master' },
{ id: 2, name: 'development' },
];
const TEST_BRANCHES_SELECTIONS = [TEST_DEFAULT_BRANCH, ...TEST_PROTECTED_BRANCHES]; 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 select2Container = () => document.querySelector('.select2-container');
......
...@@ -89,11 +89,7 @@ describe('EE Approvals LicenseCompliance Modal', () => { ...@@ -89,11 +89,7 @@ describe('EE Approvals LicenseCompliance Modal', () => {
createWrapper(); createWrapper();
expect( expect(findModal().attributes('title').startsWith(expectTitleStartsWith)).toBe(true);
findModal()
.attributes('title')
.startsWith(expectTitleStartsWith),
).toBe(true);
}); });
}); });
......
...@@ -53,12 +53,7 @@ describe('EE Approvals MREditApp', () => { ...@@ -53,12 +53,7 @@ describe('EE Approvals MREditApp', () => {
}); });
it('renders hidden inputs', () => { it('renders hidden inputs', () => {
expect( expect(wrapper.find('.js-approval-rules').find(MRRulesHiddenInputs).exists()).toBe(true);
wrapper
.find('.js-approval-rules')
.find(MRRulesHiddenInputs)
.exists(),
).toBe(true);
}); });
}); });
...@@ -76,12 +71,7 @@ describe('EE Approvals MREditApp', () => { ...@@ -76,12 +71,7 @@ describe('EE Approvals MREditApp', () => {
store.modules.approvals.state.rules = [{ id: 7, approvers: [] }]; store.modules.approvals.state.rules = [{ id: 7, approvers: [] }];
factory(); factory();
expect( expect(wrapper.find('.js-approval-rules').find(MRRulesHiddenInputs).exists()).toBe(true);
wrapper
.find('.js-approval-rules')
.find(MRRulesHiddenInputs)
.exists(),
).toBe(true);
}); });
describe('summary text', () => { describe('summary text', () => {
......
...@@ -34,11 +34,7 @@ describe('EE Approvals MRRules', () => { ...@@ -34,11 +34,7 @@ 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 findRuleName = () => wrapper.find('.js-name');
const findRuleIndicator = () => wrapper.find({ ref: 'indicator' }); const findRuleIndicator = () => wrapper.find({ ref: 'indicator' });
const findRuleMembers = () => const findRuleMembers = () => wrapper.find('td.js-members').find(UserAvatarList).props('items');
wrapper
.find('td.js-members')
.find(UserAvatarList)
.props('items');
const findRuleControls = () => wrapper.find('td.js-controls').find(RuleControls); const findRuleControls = () => wrapper.find('td.js-controls').find(RuleControls);
const callTargetBranchHandler = MutationObserverSpy => { const callTargetBranchHandler = MutationObserverSpy => {
const onTargetBranchMutationHandler = MutationObserverSpy.mock.calls[0][0]; const onTargetBranchMutationHandler = MutationObserverSpy.mock.calls[0][0];
......
...@@ -20,13 +20,7 @@ describe('AuditEventsTable component', () => { ...@@ -20,13 +20,7 @@ describe('AuditEventsTable component', () => {
}; };
const getCell = (trIdx, tdIdx) => { const getCell = (trIdx, tdIdx) => {
return wrapper return wrapper.find(GlTable).find('tbody').findAll('tr').at(trIdx).findAll('td').at(tdIdx);
.find(GlTable)
.find('tbody')
.findAll('tr')
.at(trIdx)
.findAll('td')
.at(tdIdx);
}; };
beforeEach(() => { beforeEach(() => {
......
...@@ -24,12 +24,7 @@ describe('DateRangeButtons component', () => { ...@@ -24,12 +24,7 @@ describe('DateRangeButtons component', () => {
dateRange: { startDate: getDateInPast(CURRENT_DATE, 7), endDate: CURRENT_DATE }, dateRange: { startDate: getDateInPast(CURRENT_DATE, 7), endDate: CURRENT_DATE },
}); });
expect( expect(wrapper.find(GlButtonGroup).find('[selected="true"]').text()).toBe('Last 7 days');
wrapper
.find(GlButtonGroup)
.find('[selected="true"]')
.text(),
).toBe('Last 7 days');
}); });
it('shows no date range as selected when the dateRange property does not match any option', () => { it('shows no date range as selected when the dateRange property does not match any option', () => {
...@@ -40,22 +35,14 @@ describe('DateRangeButtons component', () => { ...@@ -40,22 +35,14 @@ describe('DateRangeButtons component', () => {
}, },
}); });
expect( expect(wrapper.find(GlButtonGroup).find('[selected="true"]').exists()).toBe(false);
wrapper
.find(GlButtonGroup)
.find('[selected="true"]')
.exists(),
).toBe(false);
}); });
it('emits an "input" event with the dateRange when a new date range is selected', async () => { it('emits an "input" event with the dateRange when a new date range is selected', async () => {
createComponent({ createComponent({
dateRange: { startDate: getDateInPast(CURRENT_DATE, 1), endDate: CURRENT_DATE }, dateRange: { startDate: getDateInPast(CURRENT_DATE, 1), endDate: CURRENT_DATE },
}); });
wrapper wrapper.find(GlButtonGroup).find(GlButton).vm.$emit('click');
.find(GlButtonGroup)
.find(GlButton)
.vm.$emit('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.emitted().input[0]).toEqual([ expect(wrapper.emitted().input[0]).toEqual([
......
...@@ -40,31 +40,25 @@ describe('DateRangeField component', () => { ...@@ -40,31 +40,25 @@ describe('DateRangeField component', () => {
it("sets the max selectable date to today's date on the date picker", () => { it("sets the max selectable date to today's date on the date picker", () => {
createComponent(); createComponent();
expect( expect(findDatePicker().props('defaultMaxDate').toDateString()).toBe(
findDatePicker() CURRENT_DATE.toDateString(),
.props('defaultMaxDate') );
.toDateString(),
).toBe(CURRENT_DATE.toDateString());
}); });
it('sets the default start date to the start of the month', () => { it('sets the default start date to the start of the month', () => {
createComponent(); createComponent();
expect( expect(findDatePicker().props('defaultStartDate').toDateString()).toBe(
findDatePicker() dateAtFirstDayOfMonth(CURRENT_DATE).toDateString(),
.props('defaultStartDate') );
.toDateString(),
).toBe(dateAtFirstDayOfMonth(CURRENT_DATE).toDateString());
}); });
it("sets the default end date to today's date", () => { it("sets the default end date to today's date", () => {
createComponent(); createComponent();
expect( expect(findDatePicker().props('defaultEndDate').toDateString()).toBe(
findDatePicker() CURRENT_DATE.toDateString(),
.props('defaultEndDate') );
.toDateString(),
).toBe(CURRENT_DATE.toDateString());
}); });
it('passes both startDate and endDate to the date picker as default dates', () => { it('passes both startDate and endDate to the date picker as default dates', () => {
......
...@@ -41,11 +41,7 @@ describe('SortingField component', () => { ...@@ -41,11 +41,7 @@ describe('SortingField component', () => {
it('should set the sorting option accordingly', () => { it('should set the sorting option accordingly', () => {
expect(getCheckedOptions()).toHaveLength(1); expect(getCheckedOptions()).toHaveLength(1);
expect( expect(getCheckedOptions().at(0).text()).toEqual('Oldest created');
getCheckedOptions()
.at(0)
.text(),
).toEqual('Oldest created');
}); });
}); });
}); });
...@@ -53,10 +49,7 @@ describe('SortingField component', () => { ...@@ -53,10 +49,7 @@ describe('SortingField component', () => {
describe('when the user clicks on a option', () => { describe('when the user clicks on a option', () => {
beforeEach(() => { beforeEach(() => {
initComponent(); initComponent();
wrapper wrapper.findAll(GlDropdownItem).at(1).vm.$emit('click');
.findAll(GlDropdownItem)
.at(1)
.vm.$emit('click');
}); });
it('should emit the "selected" event with clicked option', () => { it('should emit the "selected" event with clicked option', () => {
......
...@@ -86,10 +86,7 @@ describe('subscription table row', () => { ...@@ -86,10 +86,7 @@ describe('subscription table row', () => {
}); });
}; };
const findUsageButton = () => const findUsageButton = () => findContentCells().at(0).find('[data-testid="seats-usage-button"]');
findContentCells()
.at(0)
.find('[data-testid="seats-usage-button"]');
describe('dispatched actions', () => { describe('dispatched actions', () => {
it('dispatches action when created if namespace is group', () => { it('dispatches action when created if namespace is group', () => {
......
...@@ -42,7 +42,7 @@ describe('ee/BoardContentSidebar', () => { ...@@ -42,7 +42,7 @@ describe('ee/BoardContentSidebar', () => {
beforeEach(() => { beforeEach(() => {
store = createStore(); store = createStore();
store.state.sidebarType = ISSUABLE; store.state.sidebarType = ISSUABLE;
store.state.issues = { '1': { title: 'One', referencePath: 'path', assignees: [] } }; store.state.issues = { 1: { title: 'One', referencePath: 'path', assignees: [] } };
store.state.activeId = '1'; store.state.activeId = '1';
createComponent(); createComponent();
......
...@@ -103,20 +103,14 @@ describe('EpicsSwimlanes', () => { ...@@ -103,20 +103,14 @@ describe('EpicsSwimlanes', () => {
}); });
it('makes non preset lists draggable', () => { it('makes non preset lists draggable', () => {
expect( expect(wrapper.findAll('[data-testid="board-header-container"]').at(1).classes()).toContain(
wrapper 'is-draggable',
.findAll('[data-testid="board-header-container"]') );
.at(1)
.classes(),
).toContain('is-draggable');
}); });
it('does not make preset lists draggable', () => { it('does not make preset lists draggable', () => {
expect( expect(
wrapper wrapper.findAll('[data-testid="board-header-container"]').at(0).classes(),
.findAll('[data-testid="board-header-container"]')
.at(0)
.classes(),
).not.toContain('is-draggable'); ).not.toContain('is-draggable');
}); });
}); });
......
...@@ -25,7 +25,7 @@ describe('BoardSidebarTimeTracker', () => { ...@@ -25,7 +25,7 @@ describe('BoardSidebarTimeTracker', () => {
beforeEach(() => { beforeEach(() => {
store = createStore(); store = createStore();
store.state.issues = { store.state.issues = {
'1': { 1: {
timeEstimate: 3600, timeEstimate: 3600,
totalTimeSpent: 1800, totalTimeSpent: 1800,
humanTimeEstimate: '1h', humanTimeEstimate: '1h',
......
...@@ -8,10 +8,7 @@ describe('WeightSelect', () => { ...@@ -8,10 +8,7 @@ describe('WeightSelect', () => {
const editButton = () => wrapper.find(GlButton); const editButton = () => wrapper.find(GlButton);
const valueContainer = () => wrapper.find('.value'); const valueContainer = () => wrapper.find('.value');
const weightDropdown = () => wrapper.find(GlDropdown); const weightDropdown = () => wrapper.find(GlDropdown);
const getWeightItemAtIndex = index => const getWeightItemAtIndex = index => weightDropdown().findAll(GlDropdownItem).at(index);
weightDropdown()
.findAll(GlDropdownItem)
.at(index);
const defaultProps = { const defaultProps = {
weights: ['Any', 'None', 0, 1, 2, 3], weights: ['Any', 'None', 0, 1, 2, 3],
board: { board: {
......
...@@ -312,7 +312,9 @@ describe('updateListWipLimit', () => { ...@@ -312,7 +312,9 @@ describe('updateListWipLimit', () => {
.then(() => { .then(() => {
expect(axios.put).toHaveBeenCalledWith( expect(axios.put).toHaveBeenCalledWith(
`${boardsStoreEE.store.state.endpoints.listsEndpoint}/${activeId}`, `${boardsStoreEE.store.state.endpoints.listsEndpoint}/${activeId}`,
{ list: { max_issue_count: maxIssueCount } }, {
list: { max_issue_count: maxIssueCount },
},
); );
}); });
}); });
...@@ -620,8 +622,8 @@ describe('moveIssue', () => { ...@@ -620,8 +622,8 @@ describe('moveIssue', () => {
}; };
const issues = { const issues = {
'436': mockIssue, 436: mockIssue,
'437': mockIssue2, 437: mockIssue2,
}; };
const state = { const state = {
......
...@@ -98,8 +98,8 @@ describe('RECEIVE_ISSUES_FOR_EPIC_SUCCESS', () => { ...@@ -98,8 +98,8 @@ describe('RECEIVE_ISSUES_FOR_EPIC_SUCCESS', () => {
'gid://gitlab/List/2': [mockIssue2.id], 'gid://gitlab/List/2': [mockIssue2.id],
}; };
const issues = { const issues = {
'436': mockIssue, 436: mockIssue,
'437': mockIssue2, 437: mockIssue2,
}; };
mutations.RECEIVE_ISSUES_FOR_EPIC_SUCCESS(state, { mutations.RECEIVE_ISSUES_FOR_EPIC_SUCCESS(state, {
...@@ -265,8 +265,8 @@ describe('MOVE_ISSUE', () => { ...@@ -265,8 +265,8 @@ describe('MOVE_ISSUE', () => {
}; };
const issues = { const issues = {
'436': mockIssue, 436: mockIssue,
'437': mockIssue2, 437: mockIssue2,
}; };
state = { state = {
......
...@@ -232,7 +232,11 @@ describe('BurndownChartData', () => { ...@@ -232,7 +232,11 @@ describe('BurndownChartData', () => {
it('generates an array of arrays with date and issue count', () => { it('generates an array of arrays with date and issue count', () => {
const { burnupScope } = burndownChartData().generateBurnupTimeseries({ milestoneId }); const { burnupScope } = burndownChartData().generateBurnupTimeseries({ milestoneId });
expect(burnupScope).toEqual([['2017-03-01', 2], ['2017-03-02', 1], ['2017-03-03', 0]]); expect(burnupScope).toEqual([
['2017-03-01', 2],
['2017-03-02', 1],
['2017-03-03', 0],
]);
}); });
it('starts from 0', () => { it('starts from 0', () => {
...@@ -265,7 +269,11 @@ describe('BurndownChartData', () => { ...@@ -265,7 +269,11 @@ describe('BurndownChartData', () => {
milestoneId, milestoneId,
}); });
expect(burnupScope).toEqual([['2017-03-01', 0], ['2017-03-02', 0], ['2017-03-03', 0]]); expect(burnupScope).toEqual([
['2017-03-01', 0],
['2017-03-02', 0],
['2017-03-03', 0],
]);
}); });
it('ignores removed from other milestones', () => { it('ignores removed from other milestones', () => {
...@@ -289,7 +297,11 @@ describe('BurndownChartData', () => { ...@@ -289,7 +297,11 @@ describe('BurndownChartData', () => {
const { burnupScope } = burndownChartData(events).generateBurnupTimeseries({ milestoneId }); const { burnupScope } = burndownChartData(events).generateBurnupTimeseries({ milestoneId });
expect(burnupScope).toEqual([['2017-03-01', 1], ['2017-03-02', 1], ['2017-03-03', 1]]); expect(burnupScope).toEqual([
['2017-03-01', 1],
['2017-03-02', 1],
['2017-03-03', 1],
]);
}); });
it('only adds milestone event_type', () => { it('only adds milestone event_type', () => {
...@@ -314,7 +326,11 @@ describe('BurndownChartData', () => { ...@@ -314,7 +326,11 @@ describe('BurndownChartData', () => {
const { burnupScope } = burndownChartData(events).generateBurnupTimeseries({ milestoneId }); const { burnupScope } = burndownChartData(events).generateBurnupTimeseries({ milestoneId });
expect(burnupScope).toEqual([['2017-03-01', 0], ['2017-03-02', 1], ['2017-03-03', 1]]); expect(burnupScope).toEqual([
['2017-03-01', 0],
['2017-03-02', 1],
['2017-03-03', 1],
]);
}); });
it('only removes milestone event_type', () => { it('only removes milestone event_type', () => {
...@@ -345,7 +361,11 @@ describe('BurndownChartData', () => { ...@@ -345,7 +361,11 @@ describe('BurndownChartData', () => {
const { burnupScope } = burndownChartData(events).generateBurnupTimeseries({ milestoneId }); const { burnupScope } = burndownChartData(events).generateBurnupTimeseries({ milestoneId });
expect(burnupScope).toEqual([['2017-03-01', 1], ['2017-03-02', 1], ['2017-03-03', 0]]); expect(burnupScope).toEqual([
['2017-03-01', 1],
['2017-03-02', 1],
['2017-03-03', 0],
]);
}); });
}); });
}); });
...@@ -80,11 +80,7 @@ describe('burndown_chart', () => { ...@@ -80,11 +80,7 @@ describe('burndown_chart', () => {
createComponent(); createComponent();
expect(findActiveButtons()).toHaveLength(1); expect(findActiveButtons()).toHaveLength(1);
expect( expect(findActiveButtons().at(0).text()).toBe('Issues');
findActiveButtons()
.at(0)
.text(),
).toBe('Issues');
expect(findBurndownChart().props('issuesSelected')).toBe(true); expect(findBurndownChart().props('issuesSelected')).toBe(true);
}); });
...@@ -96,11 +92,7 @@ describe('burndown_chart', () => { ...@@ -96,11 +92,7 @@ describe('burndown_chart', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(findActiveButtons()).toHaveLength(1); expect(findActiveButtons()).toHaveLength(1);
expect( expect(findActiveButtons().at(0).text()).toBe('Issue weight');
findActiveButtons()
.at(0)
.text(),
).toBe('Issue weight');
expect(findBurndownChart().props('issuesSelected')).toBe(false); expect(findBurndownChart().props('issuesSelected')).toBe(false);
}); });
......
...@@ -34,21 +34,9 @@ describe('Iterations report summary cards', () => { ...@@ -34,21 +34,9 @@ describe('Iterations report summary cards', () => {
wrapper = null; wrapper = null;
}); });
const findCompleteCard = () => const findCompleteCard = () => wrapper.findAll(GlCard).at(0).text();
wrapper const findIncompleteCard = () => wrapper.findAll(GlCard).at(1).text();
.findAll(GlCard) const findUnstartedCard = () => wrapper.findAll(GlCard).at(2).text();
.at(0)
.text();
const findIncompleteCard = () =>
wrapper
.findAll(GlCard)
.at(1)
.text();
const findUnstartedCard = () =>
wrapper
.findAll(GlCard)
.at(2)
.text();
describe('with valid totals', () => { describe('with valid totals', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -47,11 +47,7 @@ describe('MergeRequest component', () => { ...@@ -47,11 +47,7 @@ describe('MergeRequest component', () => {
}); });
it('renders the author avatar', () => { it('renders the author avatar', () => {
expect( expect(findAuthorAvatarLink().find(GlAvatar).exists()).toEqual(true);
findAuthorAvatarLink()
.find(GlAvatar)
.exists(),
).toEqual(true);
}); });
it('renders the author name', () => { it('renders the author name', () => {
......
...@@ -204,9 +204,7 @@ describe('DependenciesTable component', () => { ...@@ -204,9 +204,7 @@ describe('DependenciesTable component', () => {
}); });
it('can be displayed by clicking on the vulnerabilities badge', () => { it('can be displayed by clicking on the vulnerabilities badge', () => {
const badge = findTableRows() const badge = findTableRows().at(rowIndexWithVulnerabilities).find(GlBadge);
.at(rowIndexWithVulnerabilities)
.find(GlBadge);
badge.trigger('click'); badge.trigger('click');
return nextTick().then(() => { return nextTick().then(() => {
......
...@@ -816,7 +816,10 @@ describe('Epic Store Actions', () => { ...@@ -816,7 +816,10 @@ describe('Epic Store Actions', () => {
describe('receiveEpicLabelsSelectSuccess', () => { describe('receiveEpicLabelsSelectSuccess', () => {
it('should set provided labels param to `state.labels`', done => { it('should set provided labels param to `state.labels`', done => {
const labels = [{ id: 1, set: false }, { id: 2, set: true }]; const labels = [
{ id: 1, set: false },
{ id: 2, set: true },
];
testAction( testAction(
actions.receiveEpicLabelsSelectSuccess, actions.receiveEpicLabelsSelectSuccess,
...@@ -865,7 +868,10 @@ describe('Epic Store Actions', () => { ...@@ -865,7 +868,10 @@ describe('Epic Store Actions', () => {
}); });
describe('updateEpicLabels', () => { describe('updateEpicLabels', () => {
const labels = [{ id: 1, set: false }, { id: 2, set: true }]; const labels = [
{ id: 1, set: false },
{ id: 2, set: true },
];
it('dispatches `requestEpicLabelsSelect` and `receiveEpicLabelsSelectSuccess` actions when request succeeds', done => { it('dispatches `requestEpicLabelsSelect` and `receiveEpicLabelsSelectSuccess` actions when request succeeds', done => {
jest.spyOn(epicUtils.gqClient, 'mutate').mockReturnValue( jest.spyOn(epicUtils.gqClient, 'mutate').mockReturnValue(
......
...@@ -371,7 +371,10 @@ describe('Epic Store Mutations', () => { ...@@ -371,7 +371,10 @@ describe('Epic Store Mutations', () => {
describe('RECEIVE_EPIC_LABELS_SELECT_SUCCESS', () => { describe('RECEIVE_EPIC_LABELS_SELECT_SUCCESS', () => {
it('Should update `labels` array on state when new labels are added', () => { it('Should update `labels` array on state when new labels are added', () => {
const addedLabels = [{ id: 1, set: true }, { id: 2, set: true }]; const addedLabels = [
{ id: 1, set: true },
{ id: 2, set: true },
];
const state = { const state = {
labels: [], labels: [],
}; };
...@@ -384,7 +387,10 @@ describe('Epic Store Mutations', () => { ...@@ -384,7 +387,10 @@ describe('Epic Store Mutations', () => {
it('Should update `labels` array on state when existing labels are removed', () => { it('Should update `labels` array on state when existing labels are removed', () => {
const removedLabels = [{ id: 1, set: false }]; const removedLabels = [{ id: 1, set: false }];
const state = { const state = {
labels: [{ id: 1, set: true }, { id: 2, set: true }], labels: [
{ id: 1, set: true },
{ id: 2, set: true },
],
}; };
mutations[types.RECEIVE_EPIC_LABELS_SELECT_SUCCESS](state, removedLabels); mutations[types.RECEIVE_EPIC_LABELS_SELECT_SUCCESS](state, removedLabels);
...@@ -396,7 +402,10 @@ describe('Epic Store Mutations', () => { ...@@ -396,7 +402,10 @@ describe('Epic Store Mutations', () => {
const removedLabels = [{ id: 1, set: false }]; const removedLabels = [{ id: 1, set: false }];
const addedLabels = [{ id: 3, set: true }]; const addedLabels = [{ id: 3, set: true }];
const state = { const state = {
labels: [{ id: 1, set: true }, { id: 2, set: true }], labels: [
{ id: 1, set: true },
{ id: 2, set: true },
],
}; };
mutations[types.RECEIVE_EPIC_LABELS_SELECT_SUCCESS](state, [ mutations[types.RECEIVE_EPIC_LABELS_SELECT_SUCCESS](state, [
...@@ -405,7 +414,10 @@ describe('Epic Store Mutations', () => { ...@@ -405,7 +414,10 @@ describe('Epic Store Mutations', () => {
]); ]);
expect(state.labels).toEqual( expect(state.labels).toEqual(
expect.arrayContaining([{ id: 2, set: true }, { id: 3, set: true }]), expect.arrayContaining([
{ id: 2, set: true },
{ id: 3, set: true },
]),
); );
}); });
}); });
......
...@@ -122,11 +122,7 @@ describe('GeoNodeActionsComponent', () => { ...@@ -122,11 +122,7 @@ describe('GeoNodeActionsComponent', () => {
describe(`when nodeRemovalAllowed is ${nodeRemovalAllowed}`, () => { describe(`when nodeRemovalAllowed is ${nodeRemovalAllowed}`, () => {
it('has the correct button text', () => { it('has the correct button text', () => {
expect( expect(findRemoveButton().text().trim()).toBe('Remove');
findRemoveButton()
.text()
.trim(),
).toBe('Remove');
}); });
it(`the button's disabled attribute should be ${buttonDisabled}`, () => { it(`the button's disabled attribute should be ${buttonDisabled}`, () => {
......
...@@ -44,23 +44,13 @@ describe('GeoNodeDetailItemComponent', () => { ...@@ -44,23 +44,13 @@ describe('GeoNodeDetailItemComponent', () => {
it('renders container elements correctly', () => { it('renders container elements correctly', () => {
expect(wrapper.find('.node-detail-item').exists()).toBeTruthy(); expect(wrapper.find('.node-detail-item').exists()).toBeTruthy();
expect(wrapper.findAll('.node-detail-title')).not.toHaveLength(0); expect(wrapper.findAll('.node-detail-title')).not.toHaveLength(0);
expect( expect(wrapper.find('.node-detail-title').text().trim()).toBe('GitLab version');
wrapper
.find('.node-detail-title')
.text()
.trim(),
).toBe('GitLab version');
}); });
describe('when plain text value', () => { describe('when plain text value', () => {
it('renders plain item value', () => { it('renders plain item value', () => {
expect(wrapper.findAll('.node-detail-value')).not.toHaveLength(0); expect(wrapper.findAll('.node-detail-value')).not.toHaveLength(0);
expect( expect(wrapper.find('.node-detail-value').text().trim()).toBe('10.4.0-pre');
wrapper
.find('.node-detail-value')
.text()
.trim(),
).toBe('10.4.0-pre');
}); });
it('does not render graph item', () => { it('does not render graph item', () => {
...@@ -140,12 +130,9 @@ describe('GeoNodeDetailItemComponent', () => { ...@@ -140,12 +130,9 @@ describe('GeoNodeDetailItemComponent', () => {
}); });
it('renders synchronization disabled text', () => { it('renders synchronization disabled text', () => {
expect( expect(wrapper.find({ ref: 'disabledText' }).text().trim()).toBe(
wrapper 'Synchronization disabled',
.find({ ref: 'disabledText' }) );
.text()
.trim(),
).toBe('Synchronization disabled');
}); });
it('renders GlPopover', () => { it('renders GlPopover', () => {
......
...@@ -42,11 +42,7 @@ describe('GeoNodeHealthStatusComponent', () => { ...@@ -42,11 +42,7 @@ describe('GeoNodeHealthStatusComponent', () => {
}); });
it(`sets background of StatusPill to ${healthCssClass} when status is ${status}`, () => { it(`sets background of StatusPill to ${healthCssClass} when status is ${status}`, () => {
expect( expect(findStatusPill().classes().join(' ')).toContain(healthCssClass);
findStatusPill()
.classes()
.join(' '),
).toContain(healthCssClass);
}); });
it('renders StatusPill correctly', () => { it('renders StatusPill correctly', () => {
......
...@@ -56,11 +56,7 @@ describe('GeoNodeReplicationStatusComponent', () => { ...@@ -56,11 +56,7 @@ describe('GeoNodeReplicationStatusComponent', () => {
}); });
it(`sets background of StatusPill to ${replicationStatusCssClass} when enabled is ${enabled}`, () => { it(`sets background of StatusPill to ${replicationStatusCssClass} when enabled is ${enabled}`, () => {
expect( expect(findStatusPill().classes().join(' ')).toContain(replicationStatusCssClass);
findStatusPill()
.classes()
.join(' '),
).toContain(replicationStatusCssClass);
}); });
it('renders StatusPill correctly', () => { it('renders StatusPill correctly', () => {
......
...@@ -134,11 +134,9 @@ describe('NodeDetailsSectionVerification', () => { ...@@ -134,11 +134,9 @@ describe('NodeDetailsSectionVerification', () => {
}); });
it('contains text about Replicated data', () => { it('contains text about Replicated data', () => {
expect( expect(findGlPopover().find(GlSprintf).attributes('message')).toContain(
findGlPopover() 'Replicated data is verified',
.find(GlSprintf) );
.attributes('message'),
).toContain('Replicated data is verified');
}); });
}); });
......
...@@ -69,9 +69,7 @@ describe('GeoReplicableFilterBar', () => { ...@@ -69,9 +69,7 @@ describe('GeoReplicableFilterBar', () => {
it('clicking a dropdown item calls setFilter with its index', () => { it('clicking a dropdown item calls setFilter with its index', () => {
const index = 1; const index = 1;
findGlDropdownItems() findGlDropdownItems().at(index).vm.$emit('click');
.at(index)
.vm.$emit('click');
expect(actionSpies.setFilter).toHaveBeenCalledWith(expect.any(Object), index); expect(actionSpies.setFilter).toHaveBeenCalledWith(expect.any(Object), index);
}); });
......
...@@ -29,11 +29,7 @@ describe('User invites', () => { ...@@ -29,11 +29,7 @@ describe('User invites', () => {
}); });
it('does not set a value', () => { it('does not set a value', () => {
expect( expect(inputs().at(0).attributes('value')).toBe(undefined);
inputs()
.at(0)
.attributes('value'),
).toBe(undefined);
}); });
}); });
...@@ -49,11 +45,7 @@ describe('User invites', () => { ...@@ -49,11 +45,7 @@ describe('User invites', () => {
}); });
it.each([0, 1, 2])('restores the value of the passed emails', index => { it.each([0, 1, 2])('restores the value of the passed emails', index => {
expect( expect(inputs().at(index).attributes('value')).toBe(emails[index]);
inputs()
.at(index)
.attributes('value'),
).toBe(emails[index]);
}); });
}); });
...@@ -72,11 +64,7 @@ describe('User invites', () => { ...@@ -72,11 +64,7 @@ describe('User invites', () => {
}); });
it.each([0, 1])('does not set a value', index => { it.each([0, 1])('does not set a value', index => {
expect( expect(inputs().at(index).attributes('value')).toBe(undefined);
inputs()
.at(index)
.attributes('value'),
).toBe(undefined);
}); });
it('sets the focus to the new input field', () => { it('sets the focus to the new input field', () => {
......
...@@ -141,11 +141,7 @@ describe('List', () => { ...@@ -141,11 +141,7 @@ describe('List', () => {
}); });
it('shows the all tab', () => { it('shows the all tab', () => {
expect( expect(findTabs().at(0).attributes('title')).toBe('All');
findTabs()
.at(0)
.attributes('title'),
).toBe('All');
}); });
it('shows the disabled regulated tab', () => { it('shows the disabled regulated tab', () => {
......
...@@ -37,9 +37,7 @@ describe('CommaSeparatedListTokenSelector', () => { ...@@ -37,9 +37,7 @@ describe('CommaSeparatedListTokenSelector', () => {
const findTokenSelectorDropdown = () => findTokenSelector().find('[role="menu"]'); const findTokenSelectorDropdown = () => findTokenSelector().find('[role="menu"]');
const findErrorMessageText = () => const findErrorMessageText = () =>
findTokenSelector() findTokenSelector().find('[role="menuitem"][disabled="disabled"]').text();
.find('[role="menuitem"][disabled="disabled"]')
.text();
const setTokenSelectorInputValue = value => { const setTokenSelectorInputValue = value => {
const tokenSelectorInput = findTokenSelectorInput(); const tokenSelectorInput = findTokenSelectorInput();
......
...@@ -33,11 +33,7 @@ describe('Incidents Published Cell', () => { ...@@ -33,11 +33,7 @@ describe('Incidents Published Cell', () => {
}); });
it('render a cell with unpublished by default', () => { it('render a cell with unpublished by default', () => {
expect( expect(findCell().find(GlIcon).exists()).toBe(false);
findCell()
.find(GlIcon)
.exists(),
).toBe(false);
expect(findCell().text()).toBe('Unpublished'); expect(findCell().text()).toBe('Unpublished');
}); });
...@@ -45,11 +41,7 @@ describe('Incidents Published Cell', () => { ...@@ -45,11 +41,7 @@ describe('Incidents Published Cell', () => {
wrapper.setProps({ statusPagePublishedIncident: true }); wrapper.setProps({ statusPagePublishedIncident: true });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(findCell().find(GlIcon).exists()).toBe(true);
findCell()
.find(GlIcon)
.exists(),
).toBe(true);
}); });
}); });
}); });
......
...@@ -87,12 +87,7 @@ describe('Insights component', () => { ...@@ -87,12 +87,7 @@ describe('Insights component', () => {
it('has the correct nav tabs', async () => { it('has the correct nav tabs', async () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.find(GlDropdown).exists()).toBe(true); expect(wrapper.find(GlDropdown).exists()).toBe(true);
expect( expect(wrapper.find(GlDropdown).find(GlDropdownItem).text()).toBe(title);
wrapper
.find(GlDropdown)
.find(GlDropdownItem)
.text(),
).toBe(title);
}); });
it('should not disable the tab selector', async () => { it('should not disable the tab selector', async () => {
...@@ -118,12 +113,7 @@ describe('Insights component', () => { ...@@ -118,12 +113,7 @@ describe('Insights component', () => {
it('has the correct nav tabs', async () => { it('has the correct nav tabs', async () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.find(GlDropdown).exists()).toBe(true); expect(wrapper.find(GlDropdown).exists()).toBe(true);
expect( expect(wrapper.find(GlDropdown).find(GlDropdownItem).text()).toBe(title);
wrapper
.find(GlDropdown)
.find(GlDropdownItem)
.text(),
).toBe(title);
}); });
it('disables the tab selector', async () => { it('disables the tab selector', async () => {
......
...@@ -15,7 +15,10 @@ export const barChartData = { ...@@ -15,7 +15,10 @@ export const barChartData = {
datasets: [ datasets: [
{ {
name: 'all', name: 'all',
data: [['January', 1], ['February', 2]], data: [
['January', 1],
['February', 2],
],
}, },
], ],
xAxisTitle: 'Months', xAxisTitle: 'Months',
...@@ -26,11 +29,17 @@ export const lineChartData = { ...@@ -26,11 +29,17 @@ export const lineChartData = {
labels: ['January', 'February'], labels: ['January', 'February'],
datasets: [ datasets: [
{ {
data: [['January', 1], ['February', 2]], data: [
['January', 1],
['February', 2],
],
name: 'Alpha', name: 'Alpha',
}, },
{ {
data: [['January', 1], ['February', 2]], data: [
['January', 1],
['February', 2],
],
name: 'Beta', name: 'Beta',
}, },
], ],
......
...@@ -266,7 +266,10 @@ describe('Insights store actions', () => { ...@@ -266,7 +266,10 @@ describe('Insights store actions', () => {
actions.setActiveTab, actions.setActiveTab,
key, key,
state, state,
[{ type: 'SET_ACTIVE_TAB', payload: key }, { type: 'SET_ACTIVE_PAGE', payload: page }], [
{ type: 'SET_ACTIVE_TAB', payload: key },
{ type: 'SET_ACTIVE_PAGE', payload: page },
],
[], [],
); );
}); });
......
...@@ -10,7 +10,10 @@ describe('Insights helpers', () => { ...@@ -10,7 +10,10 @@ describe('Insights helpers', () => {
}; };
const data = { const data = {
labels: ['January', 'February'], labels: ['January', 'February'],
datasets: [{ label: 'Dataset 1', data: [1] }, { label: 'Dataset 2', data: [2] }], datasets: [
{ label: 'Dataset 1', data: [1] },
{ label: 'Dataset 2', data: [2] },
],
}; };
expect(transformChartDataForGlCharts(chart, data).xAxisTitle).toEqual('Months'); expect(transformChartDataForGlCharts(chart, data).xAxisTitle).toEqual('Months');
...@@ -23,7 +26,10 @@ describe('Insights helpers', () => { ...@@ -23,7 +26,10 @@ describe('Insights helpers', () => {
}; };
const data = { const data = {
labels: ['January', 'February'], labels: ['January', 'February'],
datasets: [{ label: 'Dataset 1', data: [1] }, { label: 'Dataset 2', data: [2] }], datasets: [
{ label: 'Dataset 1', data: [1] },
{ label: 'Dataset 2', data: [2] },
],
}; };
expect(transformChartDataForGlCharts(chart, data).yAxisTitle).toEqual('Issues'); expect(transformChartDataForGlCharts(chart, data).yAxisTitle).toEqual('Issues');
...@@ -36,7 +42,10 @@ describe('Insights helpers', () => { ...@@ -36,7 +42,10 @@ describe('Insights helpers', () => {
}; };
const data = { const data = {
labels: ['January', 'February'], labels: ['January', 'February'],
datasets: [{ label: 'Dataset 1', data: [1] }, { label: 'Dataset 2', data: [2] }], datasets: [
{ label: 'Dataset 1', data: [1] },
{ label: 'Dataset 2', data: [2] },
],
}; };
expect(transformChartDataForGlCharts(chart, data).datasets).toEqual([ expect(transformChartDataForGlCharts(chart, data).datasets).toEqual([
...@@ -52,12 +61,27 @@ describe('Insights helpers', () => { ...@@ -52,12 +61,27 @@ describe('Insights helpers', () => {
}; };
const data = { const data = {
labels: ['January', 'February'], labels: ['January', 'February'],
datasets: [{ label: 'Dataset 1', data: [1, 2] }, { label: 'Dataset 2', data: [2, 3] }], datasets: [
{ label: 'Dataset 1', data: [1, 2] },
{ label: 'Dataset 2', data: [2, 3] },
],
}; };
expect(transformChartDataForGlCharts(chart, data).datasets).toStrictEqual([ expect(transformChartDataForGlCharts(chart, data).datasets).toStrictEqual([
{ name: 'Dataset 1', data: [['January', 1], ['February', 2]] }, {
{ name: 'Dataset 2', data: [['January', 2], ['February', 3]] }, name: 'Dataset 1',
data: [
['January', 1],
['February', 2],
],
},
{
name: 'Dataset 2',
data: [
['January', 2],
['February', 3],
],
},
]); ]);
}); });
...@@ -72,7 +96,13 @@ describe('Insights helpers', () => { ...@@ -72,7 +96,13 @@ describe('Insights helpers', () => {
}; };
expect(transformChartDataForGlCharts(chart, data).datasets).toEqual([ expect(transformChartDataForGlCharts(chart, data).datasets).toEqual([
{ name: 'all', data: [['January', 1], ['February', 2]] }, {
name: 'all',
data: [
['January', 1],
['February', 2],
],
},
]); ]);
}); });
...@@ -87,7 +117,10 @@ describe('Insights helpers', () => { ...@@ -87,7 +117,10 @@ describe('Insights helpers', () => {
}; };
expect(transformChartDataForGlCharts(chart, data).datasets).toEqual({ expect(transformChartDataForGlCharts(chart, data).datasets).toEqual({
all: [['January', 1], ['February', 2]], all: [
['January', 1],
['February', 2],
],
}); });
}); });
}); });
......
...@@ -107,7 +107,10 @@ describe('Insights mutations', () => { ...@@ -107,7 +107,10 @@ describe('Insights mutations', () => {
}; };
const transformedData = { const transformedData = {
datasets: [{ name: 'Dataset 1', data: [1] }, { name: 'Dataset 2', data: [2] }], datasets: [
{ name: 'Dataset 1', data: [1] },
{ name: 'Dataset 2', data: [2] },
],
labels: ['January', 'February'], labels: ['January', 'February'],
xAxisTitle: 'Months', xAxisTitle: 'Months',
yAxisTitle: 'Issues', yAxisTitle: 'Issues',
......
...@@ -29,12 +29,9 @@ describe('RelatedIssuesList', () => { ...@@ -29,12 +29,9 @@ describe('RelatedIssuesList', () => {
}); });
it('shows weight', () => { it('shows weight', () => {
expect( expect(wrapper.find(IssueWeight).find('.board-card-info-text').text()).toBe(
wrapper issuable1.weight.toString(),
.find(IssueWeight) );
.find('.board-card-info-text')
.text(),
).toBe(issuable1.weight.toString());
}); });
}); });
}); });
...@@ -25,19 +25,11 @@ describe('IssuesAnalyticsTable', () => { ...@@ -25,19 +25,11 @@ describe('IssuesAnalyticsTable', () => {
const findTable = () => wrapper.find(GlTable); const findTable = () => wrapper.find(GlTable);
const findIssueDetailsCol = rowIndex => const findIssueDetailsCol = rowIndex =>
findTable() findTable().findAll('[data-testid="detailsCol"]').at(rowIndex);
.findAll('[data-testid="detailsCol"]')
.at(rowIndex); const findAgeCol = rowIndex => findTable().findAll('[data-testid="ageCol"]').at(rowIndex);
const findAgeCol = rowIndex => const findStatusCol = rowIndex => findTable().findAll('[data-testid="statusCol"]').at(rowIndex);
findTable()
.findAll('[data-testid="ageCol"]')
.at(rowIndex);
const findStatusCol = rowIndex =>
findTable()
.findAll('[data-testid="statusCol"]')
.at(rowIndex);
beforeEach(() => { beforeEach(() => {
jest.spyOn(Date, 'now').mockImplementation(() => new Date('2020-01-08')); jest.spyOn(Date, 'now').mockImplementation(() => new Date('2020-01-08'));
......
...@@ -91,10 +91,7 @@ describe('Iterations report tabs', () => { ...@@ -91,10 +91,7 @@ describe('Iterations report tabs', () => {
})); }));
const findIssues = () => wrapper.findAll('table tbody tr'); const findIssues = () => wrapper.findAll('table tbody tr');
const findAssigneesForIssue = index => const findAssigneesForIssue = index => findIssues().at(index).findAll(GlAvatar);
findIssues()
.at(index)
.findAll(GlAvatar);
beforeEach(() => { beforeEach(() => {
mountComponent(); mountComponent();
......
...@@ -279,21 +279,11 @@ describe('Project Licenses', () => { ...@@ -279,21 +279,11 @@ describe('Project Licenses', () => {
); );
it('it renders the correct count in "Detected in project" tab', () => { it('it renders the correct count in "Detected in project" tab', () => {
expect( expect(wrapper.findAll(GlBadge).at(0).text()).toBe(pageInfo.total.toString());
wrapper
.findAll(GlBadge)
.at(0)
.text(),
).toBe(pageInfo.total.toString());
}); });
it('it renders the correct count in "Policies" tab', () => { it('it renders the correct count in "Policies" tab', () => {
expect( expect(wrapper.findAll(GlBadge).at(1).text()).toBe(managedLicenses.length.toString());
wrapper
.findAll(GlBadge)
.at(1)
.text(),
).toBe(managedLicenses.length.toString());
}); });
}); });
......
...@@ -44,10 +44,7 @@ describe('LdapDropdownItem', () => { ...@@ -44,10 +44,7 @@ describe('LdapDropdownItem', () => {
beforeEach(() => { beforeEach(() => {
createComponent(); createComponent();
wrapper wrapper.find(GlDropdownItem).find('[role="menuitem"]').trigger('click');
.find(GlDropdownItem)
.find('[role="menuitem"]')
.trigger('click');
}); });
it('calls `updateLdapOverride` action', () => { it('calls `updateLdapOverride` action', () => {
......
...@@ -27,9 +27,7 @@ describe('OnDemandScansProfileSelector', () => { ...@@ -27,9 +27,7 @@ describe('OnDemandScansProfileSelector', () => {
})); }));
const selectFirstProfile = () => { const selectFirstProfile = () => {
return findProfilesDropdown() return findProfilesDropdown().find(GlDropdownItem).vm.$emit('click');
.find(GlDropdownItem)
.vm.$emit('click');
}; };
const createFullComponent = (options = {}) => { const createFullComponent = (options = {}) => {
......
...@@ -114,9 +114,7 @@ describe('AddEditScheduleForm', () => { ...@@ -114,9 +114,7 @@ describe('AddEditScheduleForm', () => {
}); });
it("doesn't have a red border when there is selected option", async () => { it("doesn't have a red border when there is selected option", async () => {
findDropdownOptions() findDropdownOptions().at(1).vm.$emit('click');
.at(1)
.vm.$emit('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(findTimezoneDropdown().classes()).not.toContain('invalid-dropdown'); expect(findTimezoneDropdown().classes()).not.toContain('invalid-dropdown');
}); });
......
...@@ -62,20 +62,14 @@ describe('WeeksHeaderSubItemComponent', () => { ...@@ -62,20 +62,14 @@ describe('WeeksHeaderSubItemComponent', () => {
it('sublabel has `label-dark` class when it is for the day greater than current week day', () => { it('sublabel has `label-dark` class when it is for the day greater than current week day', () => {
// Timeframe starts at Jan 1, 2018, faked today is Jan 3, 2018 (3rd item in a week timeframe) // Timeframe starts at Jan 1, 2018, faked today is Jan 3, 2018 (3rd item in a week timeframe)
// labels for dates after current have 'label-dark' class // labels for dates after current have 'label-dark' class
expect( expect(findSublabelValues().at(3).classes()).toContain('label-dark');
findSublabelValues()
.at(3)
.classes(),
).toContain('label-dark');
}); });
it("sublabel has `label-dark label-bold` classes when it is for today's date", () => { it("sublabel has `label-dark label-bold` classes when it is for today's date", () => {
// Timeframe starts at Jan 1, 2018, faked today is Jan 3, 2018 (3rd item in a week timeframe) // Timeframe starts at Jan 1, 2018, faked today is Jan 3, 2018 (3rd item in a week timeframe)
expect( expect(findSublabelValues().at(2).classes()).toEqual(
findSublabelValues() expect.arrayContaining(['label-dark', 'label-bold']),
.at(2) );
.classes(),
).toEqual(expect.arrayContaining(['label-dark', 'label-bold']));
}); });
}); });
}); });
...@@ -51,20 +51,13 @@ describe('RotationsListSectionComponent', () => { ...@@ -51,20 +51,13 @@ describe('RotationsListSectionComponent', () => {
}); });
it('renders current day indicator in the first timeline cell', () => { it('renders current day indicator in the first timeline cell', () => {
expect( expect(findTimelineCells().at(0).find(CurrentDayIndicator).exists()).toBe(true);
findTimelineCells()
.at(0)
.find(CurrentDayIndicator)
.exists(),
).toBe(true);
}); });
it('render the correct amount of rotation assignees with their name, avatar and color', () => { it('render the correct amount of rotation assignees with their name, avatar and color', () => {
expect(findRotationAssignees()).toHaveLength(2); expect(findRotationAssignees()).toHaveLength(2);
expect( expect(findRotationAssignees().at(0).props().assignee.user).toEqual(
findRotationAssignees() mockRotations[0].participants.nodes[0].user,
.at(0) );
.props().assignee.user,
).toEqual(mockRotations[0].participants.nodes[0].user);
}); });
}); });
...@@ -87,7 +87,9 @@ describe('Reset pipeline minutes button', () => { ...@@ -87,7 +87,9 @@ describe('Reset pipeline minutes button', () => {
expect(axiosSpy).toHaveBeenCalled(); expect(axiosSpy).toHaveBeenCalled();
expect($toast.show).toHaveBeenCalledWith( expect($toast.show).toHaveBeenCalledWith(
'There was an error resetting user pipeline minutes.', 'There was an error resetting user pipeline minutes.',
{ type: 'error' }, {
type: 'error',
},
); );
}); });
}); });
......
...@@ -181,12 +181,7 @@ describe('CreateIssueForm', () => { ...@@ -181,12 +181,7 @@ describe('CreateIssueForm', () => {
expect(dropdownItems).toHaveLength(mockProjects.length); expect(dropdownItems).toHaveLength(mockProjects.length);
expect(dropdownItems.at(0).text()).toContain(mockProjects[0].name); expect(dropdownItems.at(0).text()).toContain(mockProjects[0].name);
expect(dropdownItems.at(0).text()).toContain(mockProjects[0].namespace.name); expect(dropdownItems.at(0).text()).toContain(mockProjects[0].namespace.name);
expect( expect(dropdownItems.at(0).find(ProjectAvatar).exists()).toBe(true);
dropdownItems
.at(0)
.find(ProjectAvatar)
.exists(),
).toBe(true);
}); });
}); });
......
...@@ -6,11 +6,13 @@ import StateTooltip from 'ee/related_items_tree/components/state_tooltip.vue'; ...@@ -6,11 +6,13 @@ import StateTooltip from 'ee/related_items_tree/components/state_tooltip.vue';
// Ensure that mock dates dynamically computed from today // Ensure that mock dates dynamically computed from today
// so that test doesn't fail at any point in time. // so that test doesn't fail at any point in time.
const currentDate = new Date(); const currentDate = new Date();
const mockCreatedAt = `${currentDate.getFullYear() - 2}-${currentDate.getMonth() + const mockCreatedAt = `${currentDate.getFullYear() - 2}-${
1}-${currentDate.getDate()}`; currentDate.getMonth() + 1
}-${currentDate.getDate()}`;
const mockCreatedAtYear = currentDate.getFullYear() - 2; const mockCreatedAtYear = currentDate.getFullYear() - 2;
const mockClosedAt = `${currentDate.getFullYear() - 1}-${currentDate.getMonth() + const mockClosedAt = `${currentDate.getFullYear() - 1}-${
1}-${currentDate.getDate()}`; currentDate.getMonth() + 1
}-${currentDate.getDate()}`;
const mockClosedAtYear = currentDate.getFullYear() - 1; const mockClosedAtYear = currentDate.getFullYear() - 1;
const createComponent = ({ const createComponent = ({
...@@ -156,21 +158,11 @@ describe('RelatedItemsTree', () => { ...@@ -156,21 +158,11 @@ describe('RelatedItemsTree', () => {
}); });
it('renders path in bold', () => { it('renders path in bold', () => {
expect( expect(wrapper.find({ ref: 'statePath' }).text().trim()).toBe('/foo/bar#1');
wrapper
.find({ ref: 'statePath' })
.text()
.trim(),
).toBe('/foo/bar#1');
}); });
it('renders stateText in bold', () => { it('renders stateText in bold', () => {
expect( expect(wrapper.find({ ref: 'stateText' }).text().trim()).toBe('Closed');
wrapper
.find({ ref: 'stateText' })
.text()
.trim(),
).toBe('Closed');
}); });
it('renders stateTimeInWords', () => { it('renders stateTimeInWords', () => {
...@@ -178,12 +170,7 @@ describe('RelatedItemsTree', () => { ...@@ -178,12 +170,7 @@ describe('RelatedItemsTree', () => {
}); });
it('renders stateTimestamp in muted', () => { it('renders stateTimestamp in muted', () => {
expect( expect(wrapper.find({ ref: 'stateTimestamp' }).text().trim()).toContain(mockClosedAtYear);
wrapper
.find({ ref: 'stateTimestamp' })
.text()
.trim(),
).toContain(mockClosedAtYear);
}); });
}); });
}); });
......
...@@ -681,7 +681,10 @@ describe('RelatedItemsTree', () => { ...@@ -681,7 +681,10 @@ describe('RelatedItemsTree', () => {
describe(types.RECIEVE_PROJECTS_SUCCESS, () => { describe(types.RECIEVE_PROJECTS_SUCCESS, () => {
it('should set `projectsFetchInProgress` to false and provided `projects` param as it is within the state', () => { it('should set `projectsFetchInProgress` to false and provided `projects` param as it is within the state', () => {
const projects = [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }]; const projects = [
{ id: 1, name: 'foo' },
{ id: 2, name: 'bar' },
];
mutations[types.RECIEVE_PROJECTS_SUCCESS](state, projects); mutations[types.RECIEVE_PROJECTS_SUCCESS](state, projects);
......
...@@ -24,7 +24,7 @@ const createComponent = ({ ...@@ -24,7 +24,7 @@ const createComponent = ({
children = [], children = [],
childLevel = 0, childLevel = 0,
childrenEpics = {}, childrenEpics = {},
childrenFlags = { '1': { itemExpanded: false } }, childrenFlags = { 1: { itemExpanded: false } },
hasFiltersApplied = false, hasFiltersApplied = false,
} = {}) => { } = {}) => {
return mount(EpicItemContainer, { return mount(EpicItemContainer, {
...@@ -66,8 +66,8 @@ describe('EpicItemContainer', () => { ...@@ -66,8 +66,8 @@ describe('EpicItemContainer', () => {
wrapper = createComponent({ wrapper = createComponent({
children: [mockFormattedChildEpic1], children: [mockFormattedChildEpic1],
childrenFlags: { childrenFlags: {
'1': { itemExpanded: true }, 1: { itemExpanded: true },
'50': { itemExpanded: false }, 50: { itemExpanded: false },
}, },
}); });
expect(wrapper.find(EpicItem).exists()).toBe(true); expect(wrapper.find(EpicItem).exists()).toBe(true);
......
...@@ -31,7 +31,7 @@ describe('EpicItemDetails', () => { ...@@ -31,7 +31,7 @@ describe('EpicItemDetails', () => {
currentGroupId: mockGroupId, currentGroupId: mockGroupId,
timeframeString: 'Jul 10, 2017 – Jun 2, 2018', timeframeString: 'Jul 10, 2017 – Jun 2, 2018',
childLevel: 0, childLevel: 0,
childrenFlags: { '41': { itemExpanded: false } }, childrenFlags: { 41: { itemExpanded: false } },
hasFiltersApplied: false, hasFiltersApplied: false,
isChildrenEmpty: false, isChildrenEmpty: false,
...props, ...props,
...@@ -203,7 +203,7 @@ describe('EpicItemDetails', () => { ...@@ -203,7 +203,7 @@ describe('EpicItemDetails', () => {
describe('when child epics are expanded', () => { describe('when child epics are expanded', () => {
const childrenFlags = { const childrenFlags = {
'41': { itemExpanded: true }, 41: { itemExpanded: true },
}; };
beforeEach(() => { beforeEach(() => {
...@@ -241,7 +241,7 @@ describe('EpicItemDetails', () => { ...@@ -241,7 +241,7 @@ describe('EpicItemDetails', () => {
describe('when child epics are not expanded', () => { describe('when child epics are not expanded', () => {
beforeEach(() => { beforeEach(() => {
const childrenFlags = { const childrenFlags = {
'41': { itemExpanded: false }, 41: { itemExpanded: false },
}; };
createWrapper({ createWrapper({
epic, epic,
......
...@@ -35,7 +35,7 @@ const createComponent = ({ ...@@ -35,7 +35,7 @@ const createComponent = ({
currentGroupId = mockGroupId, currentGroupId = mockGroupId,
childLevel = 0, childLevel = 0,
childrenEpics = {}, childrenEpics = {},
childrenFlags = { '1': { itemExpanded: false } }, childrenFlags = { 1: { itemExpanded: false } },
hasFiltersApplied = false, hasFiltersApplied = false,
}) => { }) => {
return mount(EpicItemComponent, { return mount(EpicItemComponent, {
...@@ -170,11 +170,11 @@ describe('EpicItemComponent', () => { ...@@ -170,11 +170,11 @@ describe('EpicItemComponent', () => {
it('renders Epic item container element with class `epic-list-item-container` if epic has children and is expanded', () => { it('renders Epic item container element with class `epic-list-item-container` if epic has children and is expanded', () => {
wrapper = createComponent({ wrapper = createComponent({
childrenEpics: { childrenEpics: {
'1': [mockFormattedChildEpic1], 1: [mockFormattedChildEpic1],
}, },
childrenFlags: { childrenFlags: {
'1': { itemExpanded: true }, 1: { itemExpanded: true },
'50': { itemExpanded: false }, 50: { itemExpanded: false },
}, },
}); });
expect(wrapper.find('.epic-list-item-container').exists()).toBe(true); expect(wrapper.find('.epic-list-item-container').exists()).toBe(true);
......
...@@ -172,9 +172,7 @@ describe('MilestonesListSectionComponent', () => { ...@@ -172,9 +172,7 @@ describe('MilestonesListSectionComponent', () => {
describe('when the milestone list is expanded', () => { describe('when the milestone list is expanded', () => {
beforeEach(() => { beforeEach(() => {
findExpandButtonContainer() findExpandButtonContainer().find(GlButton).vm.$emit('click');
.find(GlButton)
.vm.$emit('click');
return wrapper.vm.$nextTick(); return wrapper.vm.$nextTick();
}); });
......
...@@ -27,7 +27,7 @@ describe('RoadmapShell', () => { ...@@ -27,7 +27,7 @@ describe('RoadmapShell', () => {
store = createStore(); store = createStore();
store.dispatch('setInitialData', { store.dispatch('setInitialData', {
defaultInnerHeight, defaultInnerHeight,
childrenFlags: { '1': { itemExpanded: false } }, childrenFlags: { 1: { itemExpanded: false } },
}); });
}; };
......
...@@ -55,10 +55,7 @@ describe('Auto-fix Settings', () => { ...@@ -55,10 +55,7 @@ describe('Auto-fix Settings', () => {
const findCheckbox = () => wrapper.find('input[type="checkbox"]'); const findCheckbox = () => wrapper.find('input[type="checkbox"]');
const findFooter = () => wrapper.find('footer'); const findFooter = () => wrapper.find('footer');
const findFooterLinks = () => findFooter().findAll('a'); const findFooterLinks = () => findFooter().findAll('a');
const getFooterTextContent = () => const getFooterTextContent = () => findFooter().text().trim();
findFooter()
.text()
.trim();
const expectCheckboxDisabled = () => expect(findCheckbox().attributes().disabled).toBeTruthy(); const expectCheckboxDisabled = () => expect(findCheckbox().attributes().disabled).toBeTruthy();
......
...@@ -121,27 +121,19 @@ describe('DAST Scanner Profile', () => { ...@@ -121,27 +121,19 @@ describe('DAST Scanner Profile', () => {
}); });
it.each(invalidValues)('is marked as invalid provided an invalid value', async value => { it.each(invalidValues)('is marked as invalid provided an invalid value', async value => {
await finder() await finder().find('input').setValue(value);
.find('input')
.setValue(value);
expect(wrapper.text()).toContain(errorMessage); expect(wrapper.text()).toContain(errorMessage);
}); });
it('is marked as valid provided a valid value', async () => { it('is marked as valid provided a valid value', async () => {
await finder() await finder().find('input').setValue(validValue);
.find('input')
.setValue(validValue);
expect(wrapper.text()).not.toContain(errorMessage); expect(wrapper.text()).not.toContain(errorMessage);
}); });
it('should allow only numbers', async () => { it('should allow only numbers', async () => {
expect( expect(finder().find('input').props('type')).toBe('number');
finder()
.find('input')
.props('type'),
).toBe('number');
}); });
}); });
......
...@@ -53,11 +53,7 @@ describe('DynamicFields component', () => { ...@@ -53,11 +53,7 @@ describe('DynamicFields component', () => {
it('passes the disabled prop to child fields', () => { it('passes the disabled prop to child fields', () => {
entities.forEach((entity, i) => { entities.forEach((entity, i) => {
expect( expect(findFields().at(i).props('disabled')).toBe(disabled);
findFields()
.at(i)
.props('disabled'),
).toBe(disabled);
}); });
}); });
}); });
......
...@@ -60,11 +60,7 @@ describe('Project List component', () => { ...@@ -60,11 +60,7 @@ describe('Project List component', () => {
it('renders a project-item with an avatar', () => { it('renders a project-item with an avatar', () => {
factory({ projects: generateMockProjects(1) }); factory({ projects: generateMockProjects(1) });
expect( expect(getFirstProjectItem().find(ProjectAvatar).exists()).toBe(true);
getFirstProjectItem()
.find(ProjectAvatar)
.exists(),
).toBe(true);
}); });
it('renders a project-item with a project name', () => { it('renders a project-item with a project name', () => {
......
...@@ -9,7 +9,10 @@ localVue.use(Vuex); ...@@ -9,7 +9,10 @@ localVue.use(Vuex);
describe('Filter component', () => { describe('Filter component', () => {
const projectId = 1; const projectId = 1;
const jobs = [{ ref: 'master', name: 'fuzz' }, { ref: 'master', name: 'fuzz 2' }]; const jobs = [
{ ref: 'master', name: 'fuzz' },
{ ref: 'master', name: 'fuzz 2' },
];
let wrapper; let wrapper;
let store; let store;
......
...@@ -76,11 +76,7 @@ describe('Security Dashboard Table Row', () => { ...@@ -76,11 +76,7 @@ describe('Security Dashboard Table Row', () => {
}); });
it('should render the severity', () => { it('should render the severity', () => {
expect( expect(findContent(0).text().toLowerCase()).toContain(vulnerability.severity);
findContent(0)
.text()
.toLowerCase(),
).toContain(vulnerability.severity);
}); });
it('should render the identifier cell', () => { it('should render the identifier cell', () => {
...@@ -90,11 +86,9 @@ describe('Security Dashboard Table Row', () => { ...@@ -90,11 +86,9 @@ describe('Security Dashboard Table Row', () => {
}); });
it('should render the report type', () => { it('should render the report type', () => {
expect( expect(findContent(3).text().toLowerCase()).toContain(
findContent(3) vulnerability.report_type.toLowerCase(),
.text() );
.toLowerCase(),
).toContain(vulnerability.report_type.toLowerCase());
}); });
it('should render the scanner vendor if the scanner does exist', () => { it('should render the scanner vendor if the scanner does exist', () => {
......
...@@ -63,9 +63,7 @@ describe('Selection Summary component', () => { ...@@ -63,9 +63,7 @@ describe('Selection Summary component', () => {
expect(wrapper.vm.dismissalReason).toBe(null); expect(wrapper.vm.dismissalReason).toBe(null);
expect(wrapper.findAll('option')).toHaveLength(4); expect(wrapper.findAll('option')).toHaveLength(4);
const option = formSelect() const option = formSelect().findAll('option').at(1);
.findAll('option')
.at(1);
option.setSelected(); option.setSelected();
formSelect().trigger('change'); formSelect().trigger('change');
......
...@@ -90,9 +90,7 @@ describe('Selection Summary', () => { ...@@ -90,9 +90,7 @@ describe('Selection Summary', () => {
selectByIndex(0); selectByIndex(0);
const option = formSelect() const option = formSelect().findAll('option').at(1);
.findAll('option')
.at(1);
option.setSelected(); option.setSelected();
formSelect().trigger('change'); formSelect().trigger('change');
...@@ -108,9 +106,7 @@ describe('Selection Summary', () => { ...@@ -108,9 +106,7 @@ describe('Selection Summary', () => {
selectByIndex(0); selectByIndex(0);
selectByIndex(1); selectByIndex(1);
const option = formSelect() const option = formSelect().findAll('option').at(1);
.findAll('option')
.at(1);
option.setSelected(); option.setSelected();
formSelect().trigger('change'); formSelect().trigger('change');
......
...@@ -86,7 +86,10 @@ describe('EE projectSelector actions', () => { ...@@ -86,7 +86,10 @@ describe('EE projectSelector actions', () => {
it(`posts the selected project's ids to the add-endpoint`, () => { it(`posts the selected project's ids to the add-endpoint`, () => {
const projectIds = ['1', '2']; const projectIds = ['1', '2'];
state.selectedProjects = [{ id: projectIds[0], name: '1' }, { id: projectIds[1], name: '2' }]; state.selectedProjects = [
{ id: projectIds[0], name: '1' },
{ id: projectIds[1], name: '2' },
];
state.projectEndpoints.add = mockAddEndpoint; state.projectEndpoints.add = mockAddEndpoint;
mockAxios.onPost(mockAddEndpoint).replyOnce(200, mockResponse); mockAxios.onPost(mockAddEndpoint).replyOnce(200, mockResponse);
......
...@@ -200,7 +200,10 @@ describe('IterationSelect', () => { ...@@ -200,7 +200,10 @@ describe('IterationSelect', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
data: { data: {
iterations: [{ id: 'id', title: 'title' }, { id: '123', title: '123' }], iterations: [
{ id: 'id', title: 'title' },
{ id: '123', title: '123' },
],
currentIteration: '123', currentIteration: '123',
}, },
}); });
...@@ -229,7 +232,10 @@ describe('IterationSelect', () => { ...@@ -229,7 +232,10 @@ describe('IterationSelect', () => {
const bootstrapComponent = mutationResp => { const bootstrapComponent = mutationResp => {
createComponent({ createComponent({
data: { data: {
iterations: [{ id: '123', title: '123' }, { id: 'id', title: 'title' }], iterations: [
{ id: '123', title: '123' },
{ id: 'id', title: 'title' },
],
currentIteration: '123', currentIteration: '123',
}, },
mutationPromise: mutationResp, mutationPromise: mutationResp,
......
...@@ -222,11 +222,7 @@ describe('Status', () => { ...@@ -222,11 +222,7 @@ describe('Status', () => {
it('shows text to ask the user to pick an option', () => { it('shows text to ask the user to pick an option', () => {
const message = 'Assign health status'; const message = 'Assign health status';
expect( expect(getDropdownElement(wrapper).find('.health-title').text()).toContain(message);
getDropdownElement(wrapper)
.find('.health-title')
.text(),
).toContain(message);
}); });
it('hides form when the `edit` button is clicked', async () => { it('hides form when the `edit` button is clicked', async () => {
......
...@@ -45,9 +45,7 @@ describe('Usage Statistics component', () => { ...@@ -45,9 +45,7 @@ describe('Usage Statistics component', () => {
it('renders text in total usage card footer', () => { it('renders text in total usage card footer', () => {
expect( expect(
getStatisticsCard('totalUsage') getStatisticsCard('totalUsage').find('[data-testid="statisticsCardFooter"]').text(),
.find('[data-testid="statisticsCardFooter"]')
.text(),
).toMatchInterpolatedText( ).toMatchInterpolatedText(
'This is the total amount of storage used across your projects within this namespace.', 'This is the total amount of storage used across your projects within this namespace.',
); );
...@@ -55,20 +53,14 @@ describe('Usage Statistics component', () => { ...@@ -55,20 +53,14 @@ describe('Usage Statistics component', () => {
it('renders text in excess usage card footer', () => { it('renders text in excess usage card footer', () => {
expect( expect(
getStatisticsCard('excessUsage') getStatisticsCard('excessUsage').find('[data-testid="statisticsCardFooter"]').text(),
.find('[data-testid="statisticsCardFooter"]')
.text(),
).toMatchInterpolatedText( ).toMatchInterpolatedText(
'This is the total amount of storage used by projects above the free 978.8KiB storage limit.', 'This is the total amount of storage used by projects above the free 978.8KiB storage limit.',
); );
}); });
it('renders button in purchased usage card footer', () => { it('renders button in purchased usage card footer', () => {
expect( expect(getStatisticsCard('purchasedUsage').find(GlButton).exists()).toBe(true);
getStatisticsCard('purchasedUsage')
.find(GlButton)
.exists(),
).toBe(true);
}); });
}); });
......
...@@ -56,12 +56,9 @@ describe('Payment Method', () => { ...@@ -56,12 +56,9 @@ describe('Payment Method', () => {
describe('showing the summary', () => { describe('showing the summary', () => {
it('should show the entered credit card details', () => { it('should show the entered credit card details', () => {
expect( expect(wrapper.find('.js-summary-line-1').html().replace(/\s+/g, ' ')).toContain(
wrapper 'Visa ending in <strong>4242</strong>',
.find('.js-summary-line-1') );
.html()
.replace(/\s+/g, ' '),
).toContain('Visa ending in <strong>4242</strong>');
}); });
it('should show the entered credit card expiration date', () => { it('should show the entered credit card expiration date', () => {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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