Commit ed189d0e authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 30 spec files: 2 of 10

Mandatory not to break master. Automatically created with prettier.
parent 6e183d50
......@@ -11,17 +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/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
......
......@@ -216,10 +216,9 @@ describe('EE Approvals App', () => {
findResetButton().vm.$emit('click');
return wrapper.vm.$nextTick().then(() => {
expect(store.modules.approvals.actions.fetchRules).toHaveBeenLastCalledWith(
expect.anything(),
{ targetBranch, resetToDefault: true },
);
expect(
store.modules.approvals.actions.fetchRules,
).toHaveBeenLastCalledWith(expect.anything(), { targetBranch, resetToDefault: true });
expect(showToast).toHaveBeenCalledWith('Approval rules reset to project defaults', {
action: {
text: 'Undo',
......
......@@ -25,23 +25,13 @@ describe('Approval Check Popover', () => {
});
it('should render the documentation link', () => {
expect(
wrapper
.find(GlPopover)
.find(GlLink)
.attributes('href'),
).toBe(documentationLink);
expect(wrapper.find(GlPopover).find(GlLink).attributes('href')).toBe(documentationLink);
});
});
describe('without a documentation link', () => {
it('should not render the documentation link', () => {
expect(
wrapper
.find(GlPopover)
.find(GlLink)
.exists(),
).toBeFalsy();
expect(wrapper.find(GlPopover).find(GlLink).exists()).toBeFalsy();
});
});
});
......@@ -7,7 +7,10 @@ import BranchesSelect from 'ee/approvals/components/branches_select.vue';
const TEST_DEFAULT_BRANCH = { name: 'Any branch' };
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 waitForEvent = ($input, event) => new Promise(resolve => $input.one(event, resolve));
const select2Container = () => document.querySelector('.select2-container');
......
......@@ -89,11 +89,7 @@ describe('EE Approvals LicenseCompliance Modal', () => {
createWrapper();
expect(
findModal()
.attributes('title')
.startsWith(expectTitleStartsWith),
).toBe(true);
expect(findModal().attributes('title').startsWith(expectTitleStartsWith)).toBe(true);
});
});
......
......@@ -53,12 +53,7 @@ describe('EE Approvals MREditApp', () => {
});
it('renders hidden inputs', () => {
expect(
wrapper
.find('.js-approval-rules')
.find(MRRulesHiddenInputs)
.exists(),
).toBe(true);
expect(wrapper.find('.js-approval-rules').find(MRRulesHiddenInputs).exists()).toBe(true);
});
});
......@@ -76,12 +71,7 @@ describe('EE Approvals MREditApp', () => {
store.modules.approvals.state.rules = [{ id: 7, approvers: [] }];
factory();
expect(
wrapper
.find('.js-approval-rules')
.find(MRRulesHiddenInputs)
.exists(),
).toBe(true);
expect(wrapper.find('.js-approval-rules').find(MRRulesHiddenInputs).exists()).toBe(true);
});
describe('summary text', () => {
......
......@@ -34,11 +34,7 @@ describe('EE Approvals MRRules', () => {
const findHeaders = () => wrapper.findAll('thead th').wrappers.map(x => x.text());
const findRuleName = () => wrapper.find('.js-name');
const findRuleIndicator = () => wrapper.find({ ref: 'indicator' });
const findRuleMembers = () =>
wrapper
.find('td.js-members')
.find(UserAvatarList)
.props('items');
const findRuleMembers = () => wrapper.find('td.js-members').find(UserAvatarList).props('items');
const findRuleControls = () => wrapper.find('td.js-controls').find(RuleControls);
const callTargetBranchHandler = MutationObserverSpy => {
const onTargetBranchMutationHandler = MutationObserverSpy.mock.calls[0][0];
......
......@@ -20,13 +20,7 @@ describe('AuditEventsTable component', () => {
};
const getCell = (trIdx, tdIdx) => {
return wrapper
.find(GlTable)
.find('tbody')
.findAll('tr')
.at(trIdx)
.findAll('td')
.at(tdIdx);
return wrapper.find(GlTable).find('tbody').findAll('tr').at(trIdx).findAll('td').at(tdIdx);
};
beforeEach(() => {
......
......@@ -24,12 +24,7 @@ describe('DateRangeButtons component', () => {
dateRange: { startDate: getDateInPast(CURRENT_DATE, 7), endDate: CURRENT_DATE },
});
expect(
wrapper
.find(GlButtonGroup)
.find('[selected="true"]')
.text(),
).toBe('Last 7 days');
expect(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', () => {
......@@ -40,22 +35,14 @@ describe('DateRangeButtons component', () => {
},
});
expect(
wrapper
.find(GlButtonGroup)
.find('[selected="true"]')
.exists(),
).toBe(false);
expect(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 () => {
createComponent({
dateRange: { startDate: getDateInPast(CURRENT_DATE, 1), endDate: CURRENT_DATE },
});
wrapper
.find(GlButtonGroup)
.find(GlButton)
.vm.$emit('click');
wrapper.find(GlButtonGroup).find(GlButton).vm.$emit('click');
await wrapper.vm.$nextTick();
expect(wrapper.emitted().input[0]).toEqual([
......
......@@ -40,31 +40,25 @@ describe('DateRangeField component', () => {
it("sets the max selectable date to today's date on the date picker", () => {
createComponent();
expect(
findDatePicker()
.props('defaultMaxDate')
.toDateString(),
).toBe(CURRENT_DATE.toDateString());
expect(findDatePicker().props('defaultMaxDate').toDateString()).toBe(
CURRENT_DATE.toDateString(),
);
});
it('sets the default start date to the start of the month', () => {
createComponent();
expect(
findDatePicker()
.props('defaultStartDate')
.toDateString(),
).toBe(dateAtFirstDayOfMonth(CURRENT_DATE).toDateString());
expect(findDatePicker().props('defaultStartDate').toDateString()).toBe(
dateAtFirstDayOfMonth(CURRENT_DATE).toDateString(),
);
});
it("sets the default end date to today's date", () => {
createComponent();
expect(
findDatePicker()
.props('defaultEndDate')
.toDateString(),
).toBe(CURRENT_DATE.toDateString());
expect(findDatePicker().props('defaultEndDate').toDateString()).toBe(
CURRENT_DATE.toDateString(),
);
});
it('passes both startDate and endDate to the date picker as default dates', () => {
......
......@@ -41,11 +41,7 @@ describe('SortingField component', () => {
it('should set the sorting option accordingly', () => {
expect(getCheckedOptions()).toHaveLength(1);
expect(
getCheckedOptions()
.at(0)
.text(),
).toEqual('Oldest created');
expect(getCheckedOptions().at(0).text()).toEqual('Oldest created');
});
});
});
......@@ -53,10 +49,7 @@ describe('SortingField component', () => {
describe('when the user clicks on a option', () => {
beforeEach(() => {
initComponent();
wrapper
.findAll(GlDropdownItem)
.at(1)
.vm.$emit('click');
wrapper.findAll(GlDropdownItem).at(1).vm.$emit('click');
});
it('should emit the "selected" event with clicked option', () => {
......
......@@ -86,10 +86,7 @@ describe('subscription table row', () => {
});
};
const findUsageButton = () =>
findContentCells()
.at(0)
.find('[data-testid="seats-usage-button"]');
const findUsageButton = () => findContentCells().at(0).find('[data-testid="seats-usage-button"]');
describe('dispatched actions', () => {
it('dispatches action when created if namespace is group', () => {
......
......@@ -42,7 +42,7 @@ describe('ee/BoardContentSidebar', () => {
beforeEach(() => {
store = createStore();
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';
createComponent();
......
......@@ -103,20 +103,14 @@ describe('EpicsSwimlanes', () => {
});
it('makes non preset lists draggable', () => {
expect(
wrapper
.findAll('[data-testid="board-header-container"]')
.at(1)
.classes(),
).toContain('is-draggable');
expect(wrapper.findAll('[data-testid="board-header-container"]').at(1).classes()).toContain(
'is-draggable',
);
});
it('does not make preset lists draggable', () => {
expect(
wrapper
.findAll('[data-testid="board-header-container"]')
.at(0)
.classes(),
wrapper.findAll('[data-testid="board-header-container"]').at(0).classes(),
).not.toContain('is-draggable');
});
});
......
......@@ -25,7 +25,7 @@ describe('BoardSidebarTimeTracker', () => {
beforeEach(() => {
store = createStore();
store.state.issues = {
'1': {
1: {
timeEstimate: 3600,
totalTimeSpent: 1800,
humanTimeEstimate: '1h',
......
......@@ -8,10 +8,7 @@ describe('WeightSelect', () => {
const editButton = () => wrapper.find(GlButton);
const valueContainer = () => wrapper.find('.value');
const weightDropdown = () => wrapper.find(GlDropdown);
const getWeightItemAtIndex = index =>
weightDropdown()
.findAll(GlDropdownItem)
.at(index);
const getWeightItemAtIndex = index => weightDropdown().findAll(GlDropdownItem).at(index);
const defaultProps = {
weights: ['Any', 'None', 0, 1, 2, 3],
board: {
......
......@@ -310,10 +310,11 @@ describe('updateListWipLimit', () => {
return actions
.updateListWipLimit({ state: { activeId }, getters }, { maxIssueCount, listId: activeId })
.then(() => {
expect(axios.put).toHaveBeenCalledWith(
`${boardsStoreEE.store.state.endpoints.listsEndpoint}/${activeId}`,
{ list: { max_issue_count: maxIssueCount } },
);
expect(
axios.put,
).toHaveBeenCalledWith(`${boardsStoreEE.store.state.endpoints.listsEndpoint}/${activeId}`, {
list: { max_issue_count: maxIssueCount },
});
});
});
......@@ -620,8 +621,8 @@ describe('moveIssue', () => {
};
const issues = {
'436': mockIssue,
'437': mockIssue2,
436: mockIssue,
437: mockIssue2,
};
const state = {
......
......@@ -98,8 +98,8 @@ describe('RECEIVE_ISSUES_FOR_EPIC_SUCCESS', () => {
'gid://gitlab/List/2': [mockIssue2.id],
};
const issues = {
'436': mockIssue,
'437': mockIssue2,
436: mockIssue,
437: mockIssue2,
};
mutations.RECEIVE_ISSUES_FOR_EPIC_SUCCESS(state, {
......@@ -265,8 +265,8 @@ describe('MOVE_ISSUE', () => {
};
const issues = {
'436': mockIssue,
'437': mockIssue2,
436: mockIssue,
437: mockIssue2,
};
state = {
......
......@@ -232,7 +232,11 @@ describe('BurndownChartData', () => {
it('generates an array of arrays with date and issue count', () => {
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', () => {
......@@ -265,7 +269,11 @@ describe('BurndownChartData', () => {
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', () => {
......@@ -289,7 +297,11 @@ describe('BurndownChartData', () => {
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', () => {
......@@ -314,7 +326,11 @@ describe('BurndownChartData', () => {
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', () => {
......@@ -345,7 +361,11 @@ describe('BurndownChartData', () => {
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', () => {
createComponent();
expect(findActiveButtons()).toHaveLength(1);
expect(
findActiveButtons()
.at(0)
.text(),
).toBe('Issues');
expect(findActiveButtons().at(0).text()).toBe('Issues');
expect(findBurndownChart().props('issuesSelected')).toBe(true);
});
......@@ -96,11 +92,7 @@ describe('burndown_chart', () => {
await wrapper.vm.$nextTick();
expect(findActiveButtons()).toHaveLength(1);
expect(
findActiveButtons()
.at(0)
.text(),
).toBe('Issue weight');
expect(findActiveButtons().at(0).text()).toBe('Issue weight');
expect(findBurndownChart().props('issuesSelected')).toBe(false);
});
......
......@@ -34,21 +34,9 @@ describe('Iterations report summary cards', () => {
wrapper = null;
});
const findCompleteCard = () =>
wrapper
.findAll(GlCard)
.at(0)
.text();
const findIncompleteCard = () =>
wrapper
.findAll(GlCard)
.at(1)
.text();
const findUnstartedCard = () =>
wrapper
.findAll(GlCard)
.at(2)
.text();
const findCompleteCard = () => wrapper.findAll(GlCard).at(0).text();
const findIncompleteCard = () => wrapper.findAll(GlCard).at(1).text();
const findUnstartedCard = () => wrapper.findAll(GlCard).at(2).text();
describe('with valid totals', () => {
beforeEach(() => {
......
......@@ -47,11 +47,7 @@ describe('MergeRequest component', () => {
});
it('renders the author avatar', () => {
expect(
findAuthorAvatarLink()
.find(GlAvatar)
.exists(),
).toEqual(true);
expect(findAuthorAvatarLink().find(GlAvatar).exists()).toEqual(true);
});
it('renders the author name', () => {
......
......@@ -204,9 +204,7 @@ describe('DependenciesTable component', () => {
});
it('can be displayed by clicking on the vulnerabilities badge', () => {
const badge = findTableRows()
.at(rowIndexWithVulnerabilities)
.find(GlBadge);
const badge = findTableRows().at(rowIndexWithVulnerabilities).find(GlBadge);
badge.trigger('click');
return nextTick().then(() => {
......
......@@ -816,7 +816,10 @@ describe('Epic Store Actions', () => {
describe('receiveEpicLabelsSelectSuccess', () => {
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(
actions.receiveEpicLabelsSelectSuccess,
......@@ -865,7 +868,10 @@ describe('Epic Store Actions', () => {
});
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 => {
jest.spyOn(epicUtils.gqClient, 'mutate').mockReturnValue(
......
......@@ -371,7 +371,10 @@ describe('Epic Store Mutations', () => {
describe('RECEIVE_EPIC_LABELS_SELECT_SUCCESS', () => {
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 = {
labels: [],
};
......@@ -384,7 +387,10 @@ describe('Epic Store Mutations', () => {
it('Should update `labels` array on state when existing labels are removed', () => {
const removedLabels = [{ id: 1, set: false }];
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);
......@@ -396,7 +402,10 @@ describe('Epic Store Mutations', () => {
const removedLabels = [{ id: 1, set: false }];
const addedLabels = [{ id: 3, set: true }];
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, [
......@@ -405,7 +414,10 @@ describe('Epic Store Mutations', () => {
]);
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', () => {
describe(`when nodeRemovalAllowed is ${nodeRemovalAllowed}`, () => {
it('has the correct button text', () => {
expect(
findRemoveButton()
.text()
.trim(),
).toBe('Remove');
expect(findRemoveButton().text().trim()).toBe('Remove');
});
it(`the button's disabled attribute should be ${buttonDisabled}`, () => {
......
......@@ -44,23 +44,13 @@ describe('GeoNodeDetailItemComponent', () => {
it('renders container elements correctly', () => {
expect(wrapper.find('.node-detail-item').exists()).toBeTruthy();
expect(wrapper.findAll('.node-detail-title')).not.toHaveLength(0);
expect(
wrapper
.find('.node-detail-title')
.text()
.trim(),
).toBe('GitLab version');
expect(wrapper.find('.node-detail-title').text().trim()).toBe('GitLab version');
});
describe('when plain text value', () => {
it('renders plain item value', () => {
expect(wrapper.findAll('.node-detail-value')).not.toHaveLength(0);
expect(
wrapper
.find('.node-detail-value')
.text()
.trim(),
).toBe('10.4.0-pre');
expect(wrapper.find('.node-detail-value').text().trim()).toBe('10.4.0-pre');
});
it('does not render graph item', () => {
......@@ -140,12 +130,9 @@ describe('GeoNodeDetailItemComponent', () => {
});
it('renders synchronization disabled text', () => {
expect(
wrapper
.find({ ref: 'disabledText' })
.text()
.trim(),
).toBe('Synchronization disabled');
expect(wrapper.find({ ref: 'disabledText' }).text().trim()).toBe(
'Synchronization disabled',
);
});
it('renders GlPopover', () => {
......
......@@ -42,11 +42,7 @@ describe('GeoNodeHealthStatusComponent', () => {
});
it(`sets background of StatusPill to ${healthCssClass} when status is ${status}`, () => {
expect(
findStatusPill()
.classes()
.join(' '),
).toContain(healthCssClass);
expect(findStatusPill().classes().join(' ')).toContain(healthCssClass);
});
it('renders StatusPill correctly', () => {
......
......@@ -56,11 +56,7 @@ describe('GeoNodeReplicationStatusComponent', () => {
});
it(`sets background of StatusPill to ${replicationStatusCssClass} when enabled is ${enabled}`, () => {
expect(
findStatusPill()
.classes()
.join(' '),
).toContain(replicationStatusCssClass);
expect(findStatusPill().classes().join(' ')).toContain(replicationStatusCssClass);
});
it('renders StatusPill correctly', () => {
......
......@@ -134,11 +134,9 @@ describe('NodeDetailsSectionVerification', () => {
});
it('contains text about Replicated data', () => {
expect(
findGlPopover()
.find(GlSprintf)
.attributes('message'),
).toContain('Replicated data is verified');
expect(findGlPopover().find(GlSprintf).attributes('message')).toContain(
'Replicated data is verified',
);
});
});
......
......@@ -69,9 +69,7 @@ describe('GeoReplicableFilterBar', () => {
it('clicking a dropdown item calls setFilter with its index', () => {
const index = 1;
findGlDropdownItems()
.at(index)
.vm.$emit('click');
findGlDropdownItems().at(index).vm.$emit('click');
expect(actionSpies.setFilter).toHaveBeenCalledWith(expect.any(Object), index);
});
......
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