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 ...@@ -11,24 +11,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.md *.md
# temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively: # 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/components
ee/spec/frontend/security_dashboard/store/modules/project_selector ee/spec/frontend/security_dashboard/store/modules/project_selector
ee/spec/frontend/sidebar/components ee/spec/frontend/sidebar/components
......
...@@ -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);
}); });
}); });
...@@ -85,10 +85,11 @@ describe('Reset pipeline minutes button', () => { ...@@ -85,10 +85,11 @@ describe('Reset pipeline minutes button', () => {
return axios.waitForAll().then(() => { return axios.waitForAll().then(() => {
expect(axiosSpy).toHaveBeenCalled(); expect(axiosSpy).toHaveBeenCalled();
expect($toast.show).toHaveBeenCalledWith( expect(
'There was an error resetting user pipeline minutes.', $toast.show,
{ type: 'error' }, ).toHaveBeenCalledWith('There was an error resetting user pipeline minutes.', {
); 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);
}); });
}); });
}); });
......
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