Commit 8ac8a1f2 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 30 spec files: 3 of 10

Mandatory not to break master. Automatically created with prettier.
parent ed189d0e
......@@ -11,24 +11,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.md
# temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively:
ee/spec/frontend/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
......
......@@ -29,11 +29,7 @@ describe('User invites', () => {
});
it('does not set a value', () => {
expect(
inputs()
.at(0)
.attributes('value'),
).toBe(undefined);
expect(inputs().at(0).attributes('value')).toBe(undefined);
});
});
......@@ -49,11 +45,7 @@ describe('User invites', () => {
});
it.each([0, 1, 2])('restores the value of the passed emails', index => {
expect(
inputs()
.at(index)
.attributes('value'),
).toBe(emails[index]);
expect(inputs().at(index).attributes('value')).toBe(emails[index]);
});
});
......@@ -72,11 +64,7 @@ describe('User invites', () => {
});
it.each([0, 1])('does not set a value', index => {
expect(
inputs()
.at(index)
.attributes('value'),
).toBe(undefined);
expect(inputs().at(index).attributes('value')).toBe(undefined);
});
it('sets the focus to the new input field', () => {
......
......@@ -141,11 +141,7 @@ describe('List', () => {
});
it('shows the all tab', () => {
expect(
findTabs()
.at(0)
.attributes('title'),
).toBe('All');
expect(findTabs().at(0).attributes('title')).toBe('All');
});
it('shows the disabled regulated tab', () => {
......
......@@ -37,9 +37,7 @@ describe('CommaSeparatedListTokenSelector', () => {
const findTokenSelectorDropdown = () => findTokenSelector().find('[role="menu"]');
const findErrorMessageText = () =>
findTokenSelector()
.find('[role="menuitem"][disabled="disabled"]')
.text();
findTokenSelector().find('[role="menuitem"][disabled="disabled"]').text();
const setTokenSelectorInputValue = value => {
const tokenSelectorInput = findTokenSelectorInput();
......
......@@ -33,11 +33,7 @@ describe('Incidents Published Cell', () => {
});
it('render a cell with unpublished by default', () => {
expect(
findCell()
.find(GlIcon)
.exists(),
).toBe(false);
expect(findCell().find(GlIcon).exists()).toBe(false);
expect(findCell().text()).toBe('Unpublished');
});
......@@ -45,11 +41,7 @@ describe('Incidents Published Cell', () => {
wrapper.setProps({ statusPagePublishedIncident: true });
return wrapper.vm.$nextTick().then(() => {
expect(
findCell()
.find(GlIcon)
.exists(),
).toBe(true);
expect(findCell().find(GlIcon).exists()).toBe(true);
});
});
});
......
......@@ -87,12 +87,7 @@ describe('Insights component', () => {
it('has the correct nav tabs', async () => {
await wrapper.vm.$nextTick();
expect(wrapper.find(GlDropdown).exists()).toBe(true);
expect(
wrapper
.find(GlDropdown)
.find(GlDropdownItem)
.text(),
).toBe(title);
expect(wrapper.find(GlDropdown).find(GlDropdownItem).text()).toBe(title);
});
it('should not disable the tab selector', async () => {
......@@ -118,12 +113,7 @@ describe('Insights component', () => {
it('has the correct nav tabs', async () => {
await wrapper.vm.$nextTick();
expect(wrapper.find(GlDropdown).exists()).toBe(true);
expect(
wrapper
.find(GlDropdown)
.find(GlDropdownItem)
.text(),
).toBe(title);
expect(wrapper.find(GlDropdown).find(GlDropdownItem).text()).toBe(title);
});
it('disables the tab selector', async () => {
......
......@@ -15,7 +15,10 @@ export const barChartData = {
datasets: [
{
name: 'all',
data: [['January', 1], ['February', 2]],
data: [
['January', 1],
['February', 2],
],
},
],
xAxisTitle: 'Months',
......@@ -26,11 +29,17 @@ export const lineChartData = {
labels: ['January', 'February'],
datasets: [
{
data: [['January', 1], ['February', 2]],
data: [
['January', 1],
['February', 2],
],
name: 'Alpha',
},
{
data: [['January', 1], ['February', 2]],
data: [
['January', 1],
['February', 2],
],
name: 'Beta',
},
],
......
......@@ -266,7 +266,10 @@ describe('Insights store actions', () => {
actions.setActiveTab,
key,
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', () => {
};
const data = {
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');
......@@ -23,7 +26,10 @@ describe('Insights helpers', () => {
};
const data = {
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');
......@@ -36,7 +42,10 @@ describe('Insights helpers', () => {
};
const data = {
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([
......@@ -52,12 +61,27 @@ describe('Insights helpers', () => {
};
const data = {
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([
{ 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', () => {
};
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', () => {
};
expect(transformChartDataForGlCharts(chart, data).datasets).toEqual({
all: [['January', 1], ['February', 2]],
all: [
['January', 1],
['February', 2],
],
});
});
});
......
......@@ -107,7 +107,10 @@ describe('Insights mutations', () => {
};
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'],
xAxisTitle: 'Months',
yAxisTitle: 'Issues',
......
......@@ -29,12 +29,9 @@ describe('RelatedIssuesList', () => {
});
it('shows weight', () => {
expect(
wrapper
.find(IssueWeight)
.find('.board-card-info-text')
.text(),
).toBe(issuable1.weight.toString());
expect(wrapper.find(IssueWeight).find('.board-card-info-text').text()).toBe(
issuable1.weight.toString(),
);
});
});
});
......@@ -25,19 +25,11 @@ describe('IssuesAnalyticsTable', () => {
const findTable = () => wrapper.find(GlTable);
const findIssueDetailsCol = rowIndex =>
findTable()
.findAll('[data-testid="detailsCol"]')
.at(rowIndex);
const findAgeCol = rowIndex =>
findTable()
.findAll('[data-testid="ageCol"]')
.at(rowIndex);
const findStatusCol = rowIndex =>
findTable()
.findAll('[data-testid="statusCol"]')
.at(rowIndex);
findTable().findAll('[data-testid="detailsCol"]').at(rowIndex);
const findAgeCol = rowIndex => findTable().findAll('[data-testid="ageCol"]').at(rowIndex);
const findStatusCol = rowIndex => findTable().findAll('[data-testid="statusCol"]').at(rowIndex);
beforeEach(() => {
jest.spyOn(Date, 'now').mockImplementation(() => new Date('2020-01-08'));
......
......@@ -91,10 +91,7 @@ describe('Iterations report tabs', () => {
}));
const findIssues = () => wrapper.findAll('table tbody tr');
const findAssigneesForIssue = index =>
findIssues()
.at(index)
.findAll(GlAvatar);
const findAssigneesForIssue = index => findIssues().at(index).findAll(GlAvatar);
beforeEach(() => {
mountComponent();
......
......@@ -279,21 +279,11 @@ describe('Project Licenses', () => {
);
it('it renders the correct count in "Detected in project" tab', () => {
expect(
wrapper
.findAll(GlBadge)
.at(0)
.text(),
).toBe(pageInfo.total.toString());
expect(wrapper.findAll(GlBadge).at(0).text()).toBe(pageInfo.total.toString());
});
it('it renders the correct count in "Policies" tab', () => {
expect(
wrapper
.findAll(GlBadge)
.at(1)
.text(),
).toBe(managedLicenses.length.toString());
expect(wrapper.findAll(GlBadge).at(1).text()).toBe(managedLicenses.length.toString());
});
});
......
......@@ -44,10 +44,7 @@ describe('LdapDropdownItem', () => {
beforeEach(() => {
createComponent();
wrapper
.find(GlDropdownItem)
.find('[role="menuitem"]')
.trigger('click');
wrapper.find(GlDropdownItem).find('[role="menuitem"]').trigger('click');
});
it('calls `updateLdapOverride` action', () => {
......
......@@ -27,9 +27,7 @@ describe('OnDemandScansProfileSelector', () => {
}));
const selectFirstProfile = () => {
return findProfilesDropdown()
.find(GlDropdownItem)
.vm.$emit('click');
return findProfilesDropdown().find(GlDropdownItem).vm.$emit('click');
};
const createFullComponent = (options = {}) => {
......
......@@ -114,9 +114,7 @@ describe('AddEditScheduleForm', () => {
});
it("doesn't have a red border when there is selected option", async () => {
findDropdownOptions()
.at(1)
.vm.$emit('click');
findDropdownOptions().at(1).vm.$emit('click');
await wrapper.vm.$nextTick();
expect(findTimezoneDropdown().classes()).not.toContain('invalid-dropdown');
});
......
......@@ -62,20 +62,14 @@ describe('WeeksHeaderSubItemComponent', () => {
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)
// labels for dates after current have 'label-dark' class
expect(
findSublabelValues()
.at(3)
.classes(),
).toContain('label-dark');
expect(findSublabelValues().at(3).classes()).toContain('label-dark');
});
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)
expect(
findSublabelValues()
.at(2)
.classes(),
).toEqual(expect.arrayContaining(['label-dark', 'label-bold']));
expect(findSublabelValues().at(2).classes()).toEqual(
expect.arrayContaining(['label-dark', 'label-bold']),
);
});
});
});
......@@ -51,20 +51,13 @@ describe('RotationsListSectionComponent', () => {
});
it('renders current day indicator in the first timeline cell', () => {
expect(
findTimelineCells()
.at(0)
.find(CurrentDayIndicator)
.exists(),
).toBe(true);
expect(findTimelineCells().at(0).find(CurrentDayIndicator).exists()).toBe(true);
});
it('render the correct amount of rotation assignees with their name, avatar and color', () => {
expect(findRotationAssignees()).toHaveLength(2);
expect(
findRotationAssignees()
.at(0)
.props().assignee.user,
).toEqual(mockRotations[0].participants.nodes[0].user);
expect(findRotationAssignees().at(0).props().assignee.user).toEqual(
mockRotations[0].participants.nodes[0].user,
);
});
});
......@@ -85,10 +85,11 @@ describe('Reset pipeline minutes button', () => {
return axios.waitForAll().then(() => {
expect(axiosSpy).toHaveBeenCalled();
expect($toast.show).toHaveBeenCalledWith(
'There was an error resetting user pipeline minutes.',
{ type: 'error' },
);
expect(
$toast.show,
).toHaveBeenCalledWith('There was an error resetting user pipeline minutes.', {
type: 'error',
});
});
});
});
......
......@@ -181,12 +181,7 @@ describe('CreateIssueForm', () => {
expect(dropdownItems).toHaveLength(mockProjects.length);
expect(dropdownItems.at(0).text()).toContain(mockProjects[0].name);
expect(dropdownItems.at(0).text()).toContain(mockProjects[0].namespace.name);
expect(
dropdownItems
.at(0)
.find(ProjectAvatar)
.exists(),
).toBe(true);
expect(dropdownItems.at(0).find(ProjectAvatar).exists()).toBe(true);
});
});
......
......@@ -6,11 +6,13 @@ import StateTooltip from 'ee/related_items_tree/components/state_tooltip.vue';
// Ensure that mock dates dynamically computed from today
// so that test doesn't fail at any point in time.
const currentDate = new Date();
const mockCreatedAt = `${currentDate.getFullYear() - 2}-${currentDate.getMonth() +
1}-${currentDate.getDate()}`;
const mockCreatedAt = `${currentDate.getFullYear() - 2}-${
currentDate.getMonth() + 1
}-${currentDate.getDate()}`;
const mockCreatedAtYear = currentDate.getFullYear() - 2;
const mockClosedAt = `${currentDate.getFullYear() - 1}-${currentDate.getMonth() +
1}-${currentDate.getDate()}`;
const mockClosedAt = `${currentDate.getFullYear() - 1}-${
currentDate.getMonth() + 1
}-${currentDate.getDate()}`;
const mockClosedAtYear = currentDate.getFullYear() - 1;
const createComponent = ({
......@@ -156,21 +158,11 @@ describe('RelatedItemsTree', () => {
});
it('renders path in bold', () => {
expect(
wrapper
.find({ ref: 'statePath' })
.text()
.trim(),
).toBe('/foo/bar#1');
expect(wrapper.find({ ref: 'statePath' }).text().trim()).toBe('/foo/bar#1');
});
it('renders stateText in bold', () => {
expect(
wrapper
.find({ ref: 'stateText' })
.text()
.trim(),
).toBe('Closed');
expect(wrapper.find({ ref: 'stateText' }).text().trim()).toBe('Closed');
});
it('renders stateTimeInWords', () => {
......@@ -178,12 +170,7 @@ describe('RelatedItemsTree', () => {
});
it('renders stateTimestamp in muted', () => {
expect(
wrapper
.find({ ref: 'stateTimestamp' })
.text()
.trim(),
).toContain(mockClosedAtYear);
expect(wrapper.find({ ref: 'stateTimestamp' }).text().trim()).toContain(mockClosedAtYear);
});
});
});
......
......@@ -681,7 +681,10 @@ describe('RelatedItemsTree', () => {
describe(types.RECIEVE_PROJECTS_SUCCESS, () => {
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);
......
......@@ -24,7 +24,7 @@ const createComponent = ({
children = [],
childLevel = 0,
childrenEpics = {},
childrenFlags = { '1': { itemExpanded: false } },
childrenFlags = { 1: { itemExpanded: false } },
hasFiltersApplied = false,
} = {}) => {
return mount(EpicItemContainer, {
......@@ -66,8 +66,8 @@ describe('EpicItemContainer', () => {
wrapper = createComponent({
children: [mockFormattedChildEpic1],
childrenFlags: {
'1': { itemExpanded: true },
'50': { itemExpanded: false },
1: { itemExpanded: true },
50: { itemExpanded: false },
},
});
expect(wrapper.find(EpicItem).exists()).toBe(true);
......
......@@ -31,7 +31,7 @@ describe('EpicItemDetails', () => {
currentGroupId: mockGroupId,
timeframeString: 'Jul 10, 2017 – Jun 2, 2018',
childLevel: 0,
childrenFlags: { '41': { itemExpanded: false } },
childrenFlags: { 41: { itemExpanded: false } },
hasFiltersApplied: false,
isChildrenEmpty: false,
...props,
......@@ -203,7 +203,7 @@ describe('EpicItemDetails', () => {
describe('when child epics are expanded', () => {
const childrenFlags = {
'41': { itemExpanded: true },
41: { itemExpanded: true },
};
beforeEach(() => {
......@@ -241,7 +241,7 @@ describe('EpicItemDetails', () => {
describe('when child epics are not expanded', () => {
beforeEach(() => {
const childrenFlags = {
'41': { itemExpanded: false },
41: { itemExpanded: false },
};
createWrapper({
epic,
......
......@@ -35,7 +35,7 @@ const createComponent = ({
currentGroupId = mockGroupId,
childLevel = 0,
childrenEpics = {},
childrenFlags = { '1': { itemExpanded: false } },
childrenFlags = { 1: { itemExpanded: false } },
hasFiltersApplied = false,
}) => {
return mount(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', () => {
wrapper = createComponent({
childrenEpics: {
'1': [mockFormattedChildEpic1],
1: [mockFormattedChildEpic1],
},
childrenFlags: {
'1': { itemExpanded: true },
'50': { itemExpanded: false },
1: { itemExpanded: true },
50: { itemExpanded: false },
},
});
expect(wrapper.find('.epic-list-item-container').exists()).toBe(true);
......
......@@ -172,9 +172,7 @@ describe('MilestonesListSectionComponent', () => {
describe('when the milestone list is expanded', () => {
beforeEach(() => {
findExpandButtonContainer()
.find(GlButton)
.vm.$emit('click');
findExpandButtonContainer().find(GlButton).vm.$emit('click');
return wrapper.vm.$nextTick();
});
......
......@@ -27,7 +27,7 @@ describe('RoadmapShell', () => {
store = createStore();
store.dispatch('setInitialData', {
defaultInnerHeight,
childrenFlags: { '1': { itemExpanded: false } },
childrenFlags: { 1: { itemExpanded: false } },
});
};
......
......@@ -55,10 +55,7 @@ describe('Auto-fix Settings', () => {
const findCheckbox = () => wrapper.find('input[type="checkbox"]');
const findFooter = () => wrapper.find('footer');
const findFooterLinks = () => findFooter().findAll('a');
const getFooterTextContent = () =>
findFooter()
.text()
.trim();
const getFooterTextContent = () => findFooter().text().trim();
const expectCheckboxDisabled = () => expect(findCheckbox().attributes().disabled).toBeTruthy();
......
......@@ -121,27 +121,19 @@ describe('DAST Scanner Profile', () => {
});
it.each(invalidValues)('is marked as invalid provided an invalid value', async value => {
await finder()
.find('input')
.setValue(value);
await finder().find('input').setValue(value);
expect(wrapper.text()).toContain(errorMessage);
});
it('is marked as valid provided a valid value', async () => {
await finder()
.find('input')
.setValue(validValue);
await finder().find('input').setValue(validValue);
expect(wrapper.text()).not.toContain(errorMessage);
});
it('should allow only numbers', async () => {
expect(
finder()
.find('input')
.props('type'),
).toBe('number');
expect(finder().find('input').props('type')).toBe('number');
});
});
......
......@@ -53,11 +53,7 @@ describe('DynamicFields component', () => {
it('passes the disabled prop to child fields', () => {
entities.forEach((entity, i) => {
expect(
findFields()
.at(i)
.props('disabled'),
).toBe(disabled);
expect(findFields().at(i).props('disabled')).toBe(disabled);
});
});
});
......
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