Commit 21fa9ca4 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 spec files: 7 of 10

Mandatory not to break master. Automatically created with prettier.
parent 8b24c8d6
......@@ -11,23 +11,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.md
# temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively:
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
......
......@@ -158,17 +158,11 @@ describe('Incidents List', () => {
describe('Assignees', () => {
it('shows Unassigned when there are no assignees', () => {
expect(
findAssignees()
.at(0)
.text(),
).toBe(I18N.unassigned);
expect(findAssignees().at(0).text()).toBe(I18N.unassigned);
});
it('renders an avatar component when there is an assignee', () => {
const avatar = findAssignees()
.at(1)
.find(GlAvatar);
const avatar = findAssignees().at(1).find(GlAvatar);
const { src, label } = avatar.attributes();
const { name, avatarUrl } = mockIncidents[1].assignees.nodes[0];
......@@ -189,9 +183,7 @@ describe('Incidents List', () => {
});
it('contains a link to the incident details page', async () => {
findTableRows()
.at(0)
.trigger('click');
findTableRows().at(0).trigger('click');
expect(visitUrl).toHaveBeenCalledWith(
joinPaths(`/project/issues/incident`, mockIncidents[0].iid),
);
......
......@@ -42,16 +42,9 @@ describe('IncidentsSettingTabs', () => {
const activeTabs = wrapper.vm.$options.tabs.filter(tab => tab.active);
expect(findIntegrationTabs().length).toBe(activeTabs.length);
activeTabs.forEach((tab, index) => {
expect(findIntegrationTabs().at(index).attributes('title')).toBe(tab.title);
expect(
findIntegrationTabs()
.at(index)
.attributes('title'),
).toBe(tab.title);
expect(
findIntegrationTabs()
.at(index)
.find(`[data-testid="${tab.component}-tab"]`)
.exists(),
findIntegrationTabs().at(index).find(`[data-testid="${tab.component}-tab"]`).exists(),
).toBe(true);
});
});
......
......@@ -57,9 +57,7 @@ describe('JiraTriggerFields', () => {
// browsers don't include unchecked boxes in form submissions.
it('includes comment settings as false even if unchecked', () => {
expect(
findCommentSettings()
.find('input[name="service[comment_on_event_enabled]"]')
.exists(),
findCommentSettings().find('input[name="service[comment_on_event_enabled]"]').exists(),
).toBe(true);
});
......
......@@ -130,10 +130,7 @@ describe('RelatedIssuesBlock', () => {
describe('showCategorizedIssues prop', () => {
const issueList = () => wrapper.findAll('.js-related-issues-token-list-item');
const categorizedHeadings = () => wrapper.findAll('h4');
const headingTextAt = index =>
categorizedHeadings()
.at(index)
.text();
const headingTextAt = index => categorizedHeadings().at(index).text();
const mountComponent = showCategorizedIssues => {
wrapper = mount(RelatedIssuesBlock, {
propsData: {
......
......@@ -182,12 +182,7 @@ describe('RelatedIssuesList', () => {
});
it('shows due date', () => {
expect(
wrapper
.find(IssueDueDate)
.find('.board-card-info-text')
.text(),
).toBe('Nov 22, 2010');
expect(wrapper.find(IssueDueDate).find('.board-card-info-text').text()).toBe('Nov 22, 2010');
});
});
});
......@@ -315,9 +315,7 @@ describe('RelatedIssuesRoot', () => {
const input = 23;
wrapper.vm.onInput({
untouchedRawReferences: String(input)
.trim()
.split(/\s/),
untouchedRawReferences: String(input).trim().split(/\s/),
touchedReference: input,
});
......
......@@ -252,12 +252,9 @@ describe('IssuableItem', () => {
await wrapper.vm.$nextTick();
expect(
wrapper
.find('[data-testid="issuable-title"]')
.find(GlLink)
.attributes('target'),
).toBe('_blank');
expect(wrapper.find('[data-testid="issuable-title"]').find(GlLink).attributes('target')).toBe(
'_blank',
);
});
it('renders issuable reference', () => {
......
......@@ -98,10 +98,7 @@ describe('IssuableBody', () => {
it('renders issuable edit info', () => {
const editedEl = wrapper.find('small');
const sanitizedText = editedEl
.text()
.replace(/\n/g, ' ')
.replace(/\s+/g, ' ');
const sanitizedText = editedEl.text().replace(/\n/g, ' ').replace(/\s+/g, ' ');
expect(sanitizedText).toContain('Edited');
expect(sanitizedText).toContain('ago');
......
......@@ -85,12 +85,7 @@ describe('Issuable suggestions app component', () => {
wrapper.setData(data);
return wrapper.vm.$nextTick(() => {
expect(
wrapper
.findAll('li')
.at(0)
.classes(),
).toContain('gl-mb-3');
expect(wrapper.findAll('li').at(0).classes()).toContain('gl-mb-3');
});
});
......@@ -98,12 +93,7 @@ describe('Issuable suggestions app component', () => {
wrapper.setData(data);
return wrapper.vm.$nextTick(() => {
expect(
wrapper
.findAll('li')
.at(1)
.classes(),
).not.toContain('gl-mb-3');
expect(wrapper.findAll('li').at(1).classes()).not.toContain('gl-mb-3');
});
});
});
......
......@@ -70,10 +70,7 @@ describe('HeaderActions component', () => {
const findModal = () => wrapper.find(GlModal);
const findModalLinkAt = index =>
findModal()
.findAll(GlLink)
.at(index);
const findModalLinkAt = index => findModal().findAll(GlLink).at(index);
const mountComponent = ({
props = {},
......
......@@ -26,11 +26,7 @@ describe('PinnedLinks', () => {
zoomMeetingUrl: `<a href="${plainZoomUrl}">Zoom</a>`,
});
expect(
findButtons()
.at(0)
.text(),
).toBe(JOIN_ZOOM_MEETING);
expect(findButtons().at(0).text()).toBe(JOIN_ZOOM_MEETING);
});
it('displays Status link', () => {
......@@ -38,11 +34,7 @@ describe('PinnedLinks', () => {
publishedIncidentUrl: `<a href="${plainStatusUrl}">Status</a>`,
});
expect(
findButtons()
.at(0)
.text(),
).toBe(STATUS_PAGE_PUBLISHED);
expect(findButtons().at(0).text()).toBe(STATUS_PAGE_PUBLISHED);
});
it('does not render if there are no links', () => {
......
......@@ -238,15 +238,15 @@ describe('Issuables list component', () => {
wrapper.vm.onSelectIssuable({ issuable: i0, selected: false });
expect(wrapper.vm.selection).toEqual({});
wrapper.vm.onSelectIssuable({ issuable: i1, selected: true });
expect(wrapper.vm.selection).toEqual({ '1': true });
expect(wrapper.vm.selection).toEqual({ 1: true });
wrapper.vm.onSelectIssuable({ issuable: i0, selected: true });
expect(wrapper.vm.selection).toEqual({ '1': true, '0': true });
expect(wrapper.vm.selection).toEqual({ 1: true, 0: true });
wrapper.vm.onSelectIssuable({ issuable: i2, selected: true });
expect(wrapper.vm.selection).toEqual({ '1': true, '0': true, '2': true });
expect(wrapper.vm.selection).toEqual({ 1: true, 0: true, 2: true });
wrapper.vm.onSelectIssuable({ issuable: i2, selected: true });
expect(wrapper.vm.selection).toEqual({ '1': true, '0': true, '2': true });
expect(wrapper.vm.selection).toEqual({ 1: true, 0: true, 2: true });
wrapper.vm.onSelectIssuable({ issuable: i0, selected: false });
expect(wrapper.vm.selection).toEqual({ '1': true, '2': true });
expect(wrapper.vm.selection).toEqual({ 1: true, 2: true });
});
it('broadcasts a message to the bulk edit sidebar when a value is added to selection', () => {
......
......@@ -46,11 +46,7 @@ describe('Empty State', () => {
});
it('renders provided title', () => {
expect(
findTitle()
.text()
.trim(),
).toBe(defaultProps.title);
expect(findTitle().text().trim()).toBe(defaultProps.title);
});
});
......@@ -60,11 +56,7 @@ describe('Empty State', () => {
});
it('renders content', () => {
expect(
findContent()
.text()
.trim(),
).toBe(content);
expect(findContent().text().trim()).toBe(content);
});
});
......
......@@ -133,13 +133,9 @@ describe('Job App', () => {
});
it('should render provided job information', () => {
expect(
wrapper
.find('.header-main-content')
.text()
.replace(/\s+/g, ' ')
.trim(),
).toContain('passed Job #4757 triggered 1 year ago by Root');
expect(wrapper.find('.header-main-content').text().replace(/\s+/g, ' ').trim()).toContain(
'passed Job #4757 triggered 1 year ago by Root',
);
});
it('should render new issue link', () => {
......@@ -151,11 +147,7 @@ describe('Job App', () => {
it('should render created key', () =>
setupAndMount().then(() => {
expect(
wrapper
.find('.header-main-content')
.text()
.replace(/\s+/g, ' ')
.trim(),
wrapper.find('.header-main-content').text().replace(/\s+/g, ' ').trim(),
).toContain('passed Job #4757 created 3 weeks ago by Root');
}));
});
......
......@@ -34,10 +34,7 @@ describe('Job Log Line', () => {
const findLine = () => wrapper.find('span');
const findLink = () => findLine().find('a');
const findLinks = () => findLine().findAll('a');
const findLinkAttributeByIndex = i =>
findLinks()
.at(i)
.attributes();
const findLinkAttributeByIndex = i => findLinks().at(i).attributes();
beforeEach(() => {
data = mockProps();
......
......@@ -62,11 +62,7 @@ describe('Job Log', () => {
});
it('renders an icon with the open state', () => {
expect(
findCollapsibleLine()
.find('[data-testid="angle-down-icon"]')
.exists(),
).toBe(true);
expect(findCollapsibleLine().find('[data-testid="angle-down-icon"]').exists()).toBe(true);
});
describe('on click header section', () => {
......
......@@ -3,7 +3,11 @@ import { firstAndLastY } from '~/lib/utils/chart_utils';
describe('Chart utils', () => {
describe('firstAndLastY', () => {
it('returns the first and last y-values of a given data set as an array', () => {
const data = [['', 1], ['', 2], ['', 3]];
const data = [
['', 1],
['', 2],
['', 3],
];
expect(firstAndLastY(data)).toEqual([1, 3]);
});
......
......@@ -181,11 +181,7 @@ describe('EnvironmentLogs', () => {
it('shows a logs trace', () => {
expect(findLogTrace().text()).toBe('');
expect(
findLogTrace()
.find('.js-build-loader-animation')
.isVisible(),
).toBe(true);
expect(findLogTrace().find('.js-build-loader-animation').isVisible()).toBe(true);
});
});
......
......@@ -57,10 +57,8 @@ describe('ResendInviteButton', () => {
it('displays form with correct action and inputs', () => {
expect(findForm().attributes('action')).toBe('/groups/foo-bar/-/group_members/1/resend_invite');
expect(
findForm()
.find('input[name="authenticity_token"]')
.attributes('value'),
).toBe('mock-csrf-token');
expect(findForm().find('input[name="authenticity_token"]').attributes('value')).toBe(
'mock-csrf-token',
);
});
});
......@@ -86,7 +86,10 @@ describe('MembersFilteredSearchBar', () => {
token: GlFilteredSearchToken,
unique: true,
operators: [{ value: '=', description: 'is' }],
options: [{ value: 'exclude', title: 'Direct' }, { value: 'only', title: 'Inherited' }],
options: [
{ value: 'exclude', title: 'Direct' },
{ value: 'only', title: 'Inherited' },
],
},
]);
});
......
......@@ -72,11 +72,9 @@ describe('ExpirationDatepicker', () => {
});
it('sets `minDate` prop as tomorrow', () => {
expect(
findDatepicker()
.props('minDate')
.toISOString(),
).toBe(new Date('2020-3-16').toISOString());
expect(findDatepicker().props('minDate').toISOString()).toBe(
new Date('2020-3-16').toISOString(),
);
});
it('sets `target` prop as `null` so datepicker opens on focus', () => {
......
......@@ -100,10 +100,7 @@ describe('MembersTable', () => {
if (expectedComponent) {
expect(
wrapper
.find(`[data-label="${label}"][role="cell"]`)
.find(expectedComponent)
.exists(),
wrapper.find(`[data-label="${label}"][role="cell"]`).find(expectedComponent).exists(),
).toBe(true);
}
});
......@@ -117,10 +114,7 @@ describe('MembersTable', () => {
expect(actionField.exists()).toBe(true);
expect(actionField.classes('gl-sr-only')).toBe(true);
expect(
wrapper
.find(`[data-label="Actions"][role="cell"]`)
.find(MemberActionButtons)
.exists(),
wrapper.find(`[data-label="Actions"][role="cell"]`).find(MemberActionButtons).exists(),
).toBe(true);
});
......@@ -177,12 +171,9 @@ describe('MembersTable', () => {
it('renders badge in "Max role" field', () => {
createComponent({ members: [memberMock], tableFields: ['maxRole'] });
expect(
wrapper
.find(`[data-label="Max role"][role="cell"]`)
.find(GlBadge)
.text(),
).toBe(memberMock.accessLevel.stringValue);
expect(wrapper.find(`[data-label="Max role"][role="cell"]`).find(GlBadge).text()).toBe(
memberMock.accessLevel.stringValue,
);
});
});
......@@ -203,10 +194,6 @@ describe('MembersTable', () => {
it('adds QA selector to table row', () => {
createComponent();
expect(
findTable()
.find('tbody tr')
.attributes('data-qa-selector'),
).toBe('member_row');
expect(findTable().find('tbody tr').attributes('data-qa-selector')).toBe('member_row');
});
});
......@@ -336,9 +336,7 @@ describe('Milestone combobox component', () => {
await localVue.nextTick();
expect(
findFirstProjectMilestonesDropdownItem()
.find('span')
.classes('selected-item'),
findFirstProjectMilestonesDropdownItem().find('span').classes('selected-item'),
).toBe(false);
selectFirstProjectMilestone();
......@@ -346,9 +344,7 @@ describe('Milestone combobox component', () => {
await localVue.nextTick();
expect(
findFirstProjectMilestonesDropdownItem()
.find('span')
.classes('selected-item'),
findFirstProjectMilestonesDropdownItem().find('span').classes('selected-item'),
).toBe(true);
});
......@@ -465,21 +461,17 @@ describe('Milestone combobox component', () => {
await localVue.nextTick();
expect(
findFirstGroupMilestonesDropdownItem()
.find('span')
.classes('selected-item'),
).toBe(false);
expect(findFirstGroupMilestonesDropdownItem().find('span').classes('selected-item')).toBe(
false,
);
selectFirstGroupMilestone();
await localVue.nextTick();
expect(
findFirstGroupMilestonesDropdownItem()
.find('span')
.classes('selected-item'),
).toBe(true);
expect(findFirstGroupMilestonesDropdownItem().find('span').classes('selected-item')).toBe(
true,
);
});
describe('when a group milestones is selected', () => {
......
......@@ -28,12 +28,20 @@ describe('AlertWidget', () => {
const nonFiringAlertResult = [
{
values: [[0, 1], [1, 42], [2, 41]],
values: [
[0, 1],
[1, 42],
[2, 41],
],
},
];
const firingAlertResult = [
{
values: [[0, 42], [1, 43], [2, 44]],
values: [
[0, 42],
[1, 43],
[2, 44],
],
},
];
const metricId = '5';
......@@ -88,10 +96,7 @@ describe('AlertWidget', () => {
const findWidgetForm = () => wrapper.find({ ref: 'widgetForm' });
const findAlertErrorMessage = () => wrapper.find({ ref: 'alertErrorMessage' });
const findCurrentSettingsText = () =>
wrapper
.find({ ref: 'alertCurrentSetting' })
.text()
.replace(/\s\s+/g, ' ');
wrapper.find({ ref: 'alertCurrentSetting' }).text().replace(/\s\s+/g, ' ');
const findBadge = () => wrapper.find(GlBadge);
const findTooltip = () => wrapper.find(GlTooltip);
......@@ -300,11 +305,7 @@ describe('AlertWidget', () => {
createComponent(propsWithManyAlerts);
return waitForPromises().then(() => {
expect(
findTooltip()
.text()
.replace(/\s\s+/g, ' '),
).toEqual('Firing: alert-label > 42');
expect(findTooltip().text().replace(/\s\s+/g, ' ')).toEqual('Firing: alert-label > 42');
});
});
});
......
......@@ -777,11 +777,7 @@ describe('Dashboard Panel', () => {
await wrapper.vm.$nextTick();
expect(findRunbookLinks().length).toBe(1);
expect(
findRunbookLinks()
.at(0)
.attributes('href'),
).toBe(invalidUrl);
expect(findRunbookLinks().at(0).attributes('href')).toBe(invalidUrl);
});
});
});
......
......@@ -587,12 +587,9 @@ describe('Dashboard', () => {
});
it('group empty area displays a NO_DATA state', () => {
expect(
wrapper
.findAll({ ref: 'empty-group' })
.at(0)
.props('selectedState'),
).toEqual(metricStates.NO_DATA);
expect(wrapper.findAll({ ref: 'empty-group' }).at(0).props('selectedState')).toEqual(
metricStates.NO_DATA,
);
});
});
......@@ -634,9 +631,7 @@ describe('Dashboard', () => {
describe('when rearrange button is clicked', () => {
const findFirstDraggableRemoveButton = () =>
findDraggablePanels()
.at(0)
.find('.js-draggable-remove');
findDraggablePanels().at(0).find('.js-draggable-remove');
beforeEach(() => {
findRearrangeButton().vm.$emit('click');
......@@ -668,11 +663,7 @@ describe('Dashboard', () => {
});
it('shows a remove button, which removes a panel', () => {
expect(
findFirstDraggableRemoveButton()
.find('a')
.exists(),
).toBe(true);
expect(findFirstDraggableRemoveButton().find('a').exists()).toBe(true);
expect(findDraggablePanels().length).toEqual(metricsDashboardPanelCount);
findFirstDraggableRemoveButton().trigger('click');
......@@ -772,10 +763,7 @@ describe('Dashboard', () => {
const panelIndex = 1; // skip expanded panel
const getClipboardTextFirstPanel = () =>
wrapper
.findAll(DashboardPanel)
.at(panelIndex)
.props('clipboardText');
wrapper.findAll(DashboardPanel).at(panelIndex).props('clipboardText');
beforeEach(() => {
setupStoreWithData(store);
......
......@@ -101,9 +101,7 @@ describe('duplicate dashboard modal', () => {
commitMessage: 'A commit message',
};
findModal()
.find(DuplicateDashboardForm)
.vm.$emit('change', formVals);
findModal().find(DuplicateDashboardForm).vm.$emit('change', formVals);
// Binding's second argument contains the modal id
expect(wrapper.vm.form).toEqual(formVals);
......
......@@ -10,7 +10,10 @@ describe('Custom variable component', () => {
label: 'Select environment',
value: 'Production',
options: {
values: [{ text: 'Production', value: 'prod' }, { text: 'Canary', value: 'canary' }],
values: [
{ text: 'Production', value: 'prod' },
{ text: 'Canary', value: 'canary' },
],
},
};
......@@ -54,9 +57,7 @@ describe('Custom variable component', () => {
createShallowWrapper();
jest.spyOn(wrapper.vm, '$emit');
findDropdownItems()
.at(1)
.vm.$emit('click');
findDropdownItems().at(1).vm.$emit('click');
return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.$emit).toHaveBeenCalledWith('input', 'canary');
......
......@@ -63,12 +63,7 @@ describe('Monitoring router', () => {
});
expect(wrapper.find(DashboardPage).exists()).toBe(true);
expect(
wrapper
.find(DashboardPage)
.find(Dashboard)
.exists(),
).toBe(true);
expect(wrapper.find(DashboardPage).find(Dashboard).exists()).toBe(true);
});
});
......@@ -91,12 +86,7 @@ describe('Monitoring router', () => {
});
expect(wrapper.find(DashboardPage).exists()).toBe(true);
expect(
wrapper
.find(DashboardPage)
.find(Dashboard)
.exists(),
).toBe(true);
expect(wrapper.find(DashboardPage).find(Dashboard).exists()).toBe(true);
});
});
......
......@@ -465,7 +465,10 @@ describe('Monitoring mutations', () => {
});
expect(variable.options).toEqual({
values: [{ text: 'prometheus', value: 'prometheus' }, { text: 'node', value: 'node' }],
values: [
{ text: 'prometheus', value: 'prometheus' },
{ text: 'node', value: 'node' },
],
});
});
});
......
......@@ -775,7 +775,11 @@ describe('normalizeQueryResponseData', () => {
job: 'prometheus',
instance: 'localhost:9090',
},
values: [[1435781430.781, '1'], [1435781445.781, '2'], [1435781460.781, '3']],
values: [
[1435781430.781, '1'],
[1435781445.781, '2'],
[1435781460.781, '3'],
],
},
{
metric: {
......@@ -783,7 +787,11 @@ describe('normalizeQueryResponseData', () => {
job: 'node',
instance: 'localhost:9091',
},
values: [[1435781430.781, '4'], [1435781445.781, '5'], [1435781460.781, '6']],
values: [
[1435781430.781, '4'],
[1435781445.781, '5'],
[1435781460.781, '6'],
],
},
],
};
......@@ -840,7 +848,10 @@ describe('normalizeQueryResponseData', () => {
job: 'prometheus',
instance: 'localhost:9090',
},
values: [[1435781430.781, '1'], [1435781460.781, 'NaN']],
values: [
[1435781430.781, '1'],
[1435781460.781, 'NaN'],
],
},
],
};
......@@ -849,7 +860,10 @@ describe('normalizeQueryResponseData', () => {
{
metric: { __name__: 'up', instance: 'localhost:9090', job: 'prometheus' },
value: ['2015-07-01T20:11:00.781Z', NaN],
values: [['2015-07-01T20:10:30.781Z', 1], ['2015-07-01T20:11:00.781Z', NaN]],
values: [
['2015-07-01T20:10:30.781Z', 1],
['2015-07-01T20:11:00.781Z', NaN],
],
},
]);
});
......
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