Commit 482d756c authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 35 spec files: 9 of 10

Mandatory not to break master. Automatically created with prettier.
parent 4700ac1d
......@@ -11,22 +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/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
......
......@@ -65,9 +65,7 @@ describe('DeleteAccountModal component', () => {
vm.isOpen = true;
Vue.nextTick()
.then(done)
.catch(done.fail);
Vue.nextTick().then(done).catch(done.fail);
});
it('does not accept empty password', done => {
......@@ -117,9 +115,7 @@ describe('DeleteAccountModal component', () => {
vm.isOpen = true;
Vue.nextTick()
.then(done)
.catch(done.fail);
Vue.nextTick().then(done).catch(done.fail);
});
it('does not accept wrong username', done => {
......
......@@ -139,11 +139,7 @@ describe('Author Select', () => {
});
it('has a "Any Author" as the first list item', () => {
expect(
findDropdownItems()
.at(0)
.text(),
).toBe('Any Author');
expect(findDropdownItems().at(0).text()).toBe('Any Author');
});
it('displays the project authors', () => {
......@@ -163,21 +159,13 @@ describe('Author Select', () => {
wrapper.setData({ currentAuthor });
return wrapper.vm.$nextTick().then(() => {
expect(
findDropdownItems()
.at(1)
.props(),
).toEqual(expect.objectContaining(result));
expect(findDropdownItems().at(1).props()).toEqual(expect.objectContaining(result));
});
});
it("display the author's name", () => {
return wrapper.vm.$nextTick().then(() => {
expect(
findDropdownItems()
.at(1)
.text(),
).toBe(currentAuthor);
expect(findDropdownItems().at(1).text()).toBe(currentAuthor);
});
});
......@@ -186,9 +174,7 @@ describe('Author Select', () => {
const spy = jest.spyOn(urlUtility, 'redirectTo');
spy.mockImplementation(() => 'mock');
findDropdownItems()
.at(1)
.vm.$emit('click');
findDropdownItems().at(1).vm.$emit('click');
expect(spy).toHaveBeenCalledWith(redirectToUrl);
});
......@@ -198,9 +184,7 @@ describe('Author Select', () => {
const spy = jest.spyOn(urlUtility, 'redirectTo');
spy.mockImplementation();
findDropdownItems()
.at(0)
.vm.$emit('click');
findDropdownItems().at(0).vm.$emit('click');
expect(spy).toHaveBeenCalledWith(redirectToUrl);
});
});
......
......@@ -25,11 +25,23 @@ export const lastYearChartData = {
export const transformedAreaChartData = [
{
name: 'all',
data: [['01 Jan', 4], ['02 Jan', 6], ['03 Jan', 3], ['04 Jan', 6], ['05 Jan', 7]],
data: [
['01 Jan', 4],
['02 Jan', 6],
['03 Jan', 3],
['04 Jan', 6],
['05 Jan', 7],
],
},
{
name: 'success',
data: [['01 Jan', 3], ['02 Jan', 3], ['03 Jan', 3], ['04 Jan', 3], ['05 Jan', 5]],
data: [
['01 Jan', 3],
['02 Jan', 3],
['03 Jan', 3],
['04 Jan', 3],
['05 Jan', 5],
],
},
];
......
......@@ -38,10 +38,7 @@ describe('New Project', () => {
beforeEach(() => {
projectNew.bindEvents();
$projectPath
.val('')
.keyup()
.val(dummyImportUrl);
$projectPath.val('').keyup().val(dummyImportUrl);
});
it('does not change project path for disabled $projectImportUrl', () => {
......
......@@ -91,12 +91,7 @@ describe('PrometheusMetrics', () => {
);
expect($metricsListLi.length).toEqual(metrics.length);
expect(
$metricsListLi
.first()
.find('.badge')
.text(),
).toEqual(`${metrics[0].active_metrics}`);
expect($metricsListLi.first().find('.badge').text()).toEqual(`${metrics[0].active_metrics}`);
});
it('should show missing environment variables list', () => {
......
......@@ -313,9 +313,7 @@ describe('Ref selector component', () => {
it('renders the "Branches" heading with a total number indicator', () => {
expect(
findBranchesSection()
.find('[data-testid="section-header"]')
.text(),
findBranchesSection().find('[data-testid="section-header"]').text(),
).toMatchInterpolatedText('Branches 123');
});
......@@ -392,9 +390,7 @@ describe('Ref selector component', () => {
it('renders the "Tags" heading with a total number indicator', () => {
expect(
findTagsSection()
.find('[data-testid="section-header"]')
.text(),
findTagsSection().find('[data-testid="section-header"]').text(),
).toMatchInterpolatedText('Tags 456');
});
......@@ -460,9 +456,7 @@ describe('Ref selector component', () => {
it('renders the "Commits" heading with a total number indicator', () => {
expect(
findCommitsSection()
.find('[data-testid="section-header"]')
.text(),
findCommitsSection().find('[data-testid="section-header"]').text(),
).toMatchInterpolatedText('Commits 1');
});
......
......@@ -306,11 +306,7 @@ describe('tags list row', () => {
});
it(`is ${clipboard} that clipboard button exist`, () => {
expect(
finderFunction()
.find(ClipboardButton)
.exists(),
).toBe(clipboard);
expect(finderFunction().find(ClipboardButton).exists()).toBe(clipboard);
});
});
});
......
......@@ -78,18 +78,14 @@ describe('Tags List', () => {
it('is enabled when at least one item is selected', async () => {
mountComponent();
findTagsListRow()
.at(0)
.vm.$emit('select');
findTagsListRow().at(0).vm.$emit('select');
await wrapper.vm.$nextTick();
expect(findDeleteButton().attributes('disabled')).toBe(undefined);
});
it('click event emits a deleted event with selected items', () => {
mountComponent();
findTagsListRow()
.at(0)
.vm.$emit('select');
findTagsListRow().at(0).vm.$emit('select');
findDeleteButton().vm.$emit('click');
expect(wrapper.emitted('delete')).toEqual([[{ 'beta-24753': true }]]);
......@@ -116,22 +112,14 @@ describe('Tags List', () => {
describe('events', () => {
it('select event update the selected items', async () => {
mountComponent();
findTagsListRow()
.at(0)
.vm.$emit('select');
findTagsListRow().at(0).vm.$emit('select');
await wrapper.vm.$nextTick();
expect(
findTagsListRow()
.at(0)
.attributes('selected'),
).toBe('true');
expect(findTagsListRow().at(0).attributes('selected')).toBe('true');
});
it('delete event emit a delete event', () => {
mountComponent();
findTagsListRow()
.at(0)
.vm.$emit('delete');
findTagsListRow().at(0).vm.$emit('delete');
expect(wrapper.emitted('delete')).toEqual([[{ 'beta-24753': true }]]);
});
});
......
......@@ -32,11 +32,7 @@ describe('TagsLoader component', () => {
it('has the correct props', () => {
mountComponent();
expect(
findGlSkeletonLoaders()
.at(0)
.props(),
).toMatchObject({
expect(findGlSkeletonLoaders().at(0).props()).toMatchObject({
width: component.loader.width,
height: component.loader.height,
});
......
......@@ -35,9 +35,7 @@ describe('Image List', () => {
it('when delete event is emitted on the row it emits up a delete event', () => {
mountComponent();
findRow()
.at(0)
.vm.$emit('delete', 'foo');
findRow().at(0).vm.$emit('delete', 'foo');
expect(wrapper.emitted('delete')).toEqual([['foo']]);
});
});
......
......@@ -119,11 +119,7 @@ describe('Registry Breadcrumb', () => {
});
it('has the same classes as the last children of the crumbs', () => {
expect(
findLastCrumb()
.classes()
.join(' '),
).toEqual(lastChildren.className);
expect(findLastCrumb().classes().join(' ')).toEqual(lastChildren.className);
});
it('has a link to the current route', () => {
......
......@@ -8,7 +8,10 @@ describe('ExpirationDropdown', () => {
const defaultProps = {
name: 'foo',
label: 'label-bar',
formOptions: [{ key: 'foo', label: 'bar' }, { key: 'baz', label: 'zab' }],
formOptions: [
{ key: 'foo', label: 'bar' },
{ key: 'baz', label: 'zab' },
],
};
const findFormSelect = () => wrapper.find(GlFormSelect);
......
......@@ -11,7 +11,10 @@ describe('Utils', () => {
[{ variable: 1 }, { variable: 2 }],
olderThanTranslationGenerator,
);
expect(result).toEqual([{ variable: 1, label: '1 day' }, { variable: 2, label: '2 days' }]);
expect(result).toEqual([
{ variable: 1, label: '1 day' },
{ variable: 2, label: '2 days' },
]);
});
});
......
......@@ -73,10 +73,7 @@ describe('RelatedMergeRequests', () => {
expect(wrapper.find('.js-items-count').text()).toEqual('2');
expect(wrapper.findAll(RelatedIssuableItem).length).toEqual(2);
const props = wrapper
.findAll(RelatedIssuableItem)
.at(1)
.props();
const props = wrapper.findAll(RelatedIssuableItem).at(1).props();
const data = mockData[1];
expect(props.idKey).toEqual(data.id);
......
......@@ -67,9 +67,7 @@ describe('Release block milestone info', () => {
).toBe(true);
milestones.forEach((m, i) => {
const milestoneLink = milestoneListContainer()
.findAll(GlLink)
.at(i);
const milestoneLink = milestoneListContainer().findAll(GlLink).at(i);
expect(milestoneLink.text()).toBe(m.title);
expect(milestoneLink.attributes('href')).toBe(m.webUrl);
......@@ -118,9 +116,7 @@ describe('Release block milestone info', () => {
});
const clickShowMoreFewerButton = () => {
milestoneListContainer()
.find(GlButton)
.trigger('click');
milestoneListContainer().find(GlButton).trigger('click');
return wrapper.vm.$nextTick();
};
......
......@@ -139,11 +139,7 @@ describe('Grouped code quality reports app', () => {
});
it('renders a help icon with more information', () => {
expect(
findWidget()
.find('[data-testid="question-icon"]')
.exists(),
).toBe(true);
expect(findWidget().find('[data-testid="question-icon"]').exists()).toBe(true);
});
});
......@@ -157,11 +153,7 @@ describe('Grouped code quality reports app', () => {
});
it('does not render a help icon', () => {
expect(
findWidget()
.find('[data-testid="question-icon"]')
.exists(),
).toBe(false);
expect(findWidget().find('[data-testid="question-icon"]').exists()).toBe(false);
});
});
});
......@@ -232,11 +232,9 @@ describe('Grouped test reports app', () => {
});
it('renders resolved errors', () => {
expect(
findAllIssueDescriptions()
.at(2)
.text(),
).toContain(resolvedFailures.suites[0].resolved_errors[0].name);
expect(findAllIssueDescriptions().at(2).text()).toContain(
resolvedFailures.suites[0].resolved_errors[0].name,
);
});
});
......
......@@ -36,23 +36,15 @@ describe('Repository breadcrumbs component', () => {
it('escapes hash in directory path', () => {
factory('app/assets/javascripts#');
expect(
vm
.findAll(RouterLinkStub)
.at(3)
.props('to'),
).toEqual('/-/tree/app/assets/javascripts%23');
expect(vm.findAll(RouterLinkStub).at(3).props('to')).toEqual(
'/-/tree/app/assets/javascripts%23',
);
});
it('renders last link as active', () => {
factory('app/assets');
expect(
vm
.findAll(RouterLinkStub)
.at(2)
.attributes('aria-current'),
).toEqual('page');
expect(vm.findAll(RouterLinkStub).at(2).attributes('aria-current')).toEqual('page');
});
it('does not render add to tree dropdown when permissions are false', () => {
......
......@@ -7,7 +7,10 @@ function factory(currentPath) {
vm = shallowMount(DirectoryDownloadLinks, {
propsData: {
currentPath,
links: [{ text: 'zip', path: 'http://test.com/' }, { text: 'tar', path: 'http://test.com/' }],
links: [
{ text: 'zip', path: 'http://test.com/' },
{ text: 'tar', path: 'http://test.com/' },
],
},
});
}
......
......@@ -79,10 +79,7 @@ describe('self monitor component', () => {
wrapper = shallowMount(SelfMonitor, { store });
expect(
wrapper
.find({ ref: 'selfMonitoringFormText' })
.find('a')
.attributes('href'),
wrapper.find({ ref: 'selfMonitoringFormText' }).find('a').attributes('href'),
).toEqual(`${TEST_HOST}/instance-administrators-random/gitlab-self-monitoring`);
});
});
......
......@@ -102,7 +102,10 @@ export const mockMetrics = {
result: [
{
metric: {},
values: [[1551352298.756, '0'], [1551352358.756, '0']],
values: [
[1551352298.756, '0'],
[1551352358.756, '0'],
],
},
],
},
......
......@@ -28,12 +28,7 @@ describe('CollapsedAssignee assignee component', () => {
it('has author name', () => {
createComponent();
expect(
wrapper
.find('.author')
.text()
.trim(),
).toEqual(TEST_USER.name);
expect(wrapper.find('.author').text().trim()).toEqual(TEST_USER.name);
});
it('has assignee avatar', () => {
......
......@@ -119,21 +119,11 @@ describe('SidebarSeverity', () => {
});
it('should display only icon with a tooltip', () => {
expect(
findSeverityToken()
.at(0)
.attributes('icononly'),
).toBe('true');
expect(
findSeverityToken()
.at(0)
.attributes('iconsize'),
).toBe('14');
expect(
findTooltip()
.text()
.replace(/\s+/g, ' '),
).toContain(`Severity: ${INCIDENT_SEVERITY[severity].label}`);
expect(findSeverityToken().at(0).attributes('icononly')).toBe('true');
expect(findSeverityToken().at(0).attributes('iconsize')).toBe('14');
expect(findTooltip().text().replace(/\s+/g, ' ')).toContain(
`Severity: ${INCIDENT_SEVERITY[severity].label}`,
);
});
it('should expand the dropdown on collapsed icon click', async () => {
......
......@@ -133,10 +133,7 @@ describe('SidebarMoveIssue', () => {
// Wait for the autocomplete request to finish
setImmediate(() => {
test.$content
.find('.js-move-issue-dropdown-item')
.eq(0)
.trigger('click');
test.$content.find('.js-move-issue-dropdown-item').eq(0).trigger('click');
expect(test.mediator.setMoveToProjectId).toHaveBeenCalledWith(0);
expect(test.$confirmButton.prop('disabled')).toBeTruthy();
......@@ -152,10 +149,7 @@ describe('SidebarMoveIssue', () => {
// Wait for the autocomplete request to finish
setImmediate(() => {
test.$content
.find('.js-move-issue-dropdown-item')
.eq(1)
.trigger('click');
test.$content.find('.js-move-issue-dropdown-item').eq(1).trigger('click');
expect(test.mediator.setMoveToProjectId).toHaveBeenCalledWith(20);
expect(test.$confirmButton.attr('disabled')).toBe(undefined);
......
......@@ -42,12 +42,7 @@ describe('SidebarTodo', () => {
({ isTodo, iconClass, label, icon }) => {
createComponent({ isTodo });
expect(
wrapper
.find(GlIcon)
.classes()
.join(' '),
).toStrictEqual(iconClass);
expect(wrapper.find(GlIcon).classes().join(' ')).toStrictEqual(iconClass);
expect(wrapper.find(GlIcon).props('name')).toStrictEqual(icon);
expect(wrapper.find('button').text()).toBe(label);
},
......
......@@ -50,14 +50,8 @@ describe('snippets/components/snippet_blob_actions_edit', () => {
},
classes: index > 0 ? ['gl-mt-3'] : [],
}));
const triggerBlobDelete = idx =>
findBlobEdits()
.at(idx)
.vm.$emit('delete');
const triggerBlobUpdate = (idx, props) =>
findBlobEdits()
.at(idx)
.vm.$emit('blob-updated', props);
const triggerBlobDelete = idx => findBlobEdits().at(idx).vm.$emit('delete');
const triggerBlobUpdate = (idx, props) => findBlobEdits().at(idx).vm.$emit('blob-updated', props);
afterEach(() => {
wrapper.destroy();
......@@ -213,11 +207,7 @@ describe('snippets/components/snippet_blob_actions_edit', () => {
it('disables delete button', () => {
expect(findBlobEdits()).toHaveLength(1);
expect(
findBlobEdits()
.at(0)
.props(),
).toMatchObject({
expect(findBlobEdits().at(0).props()).toMatchObject({
showDelete: true,
canDelete: false,
});
......
......@@ -31,10 +31,7 @@ const testApprovalRulesResponse = () => ({ rules: [{ id: 2 }] });
// For some reason, the `Promise.resolve()` needs to be deferred
// or the timing doesn't work.
const tick = () => Promise.resolve();
const waitForTick = done =>
tick()
.then(done)
.catch(done.fail);
const waitForTick = done => tick().then(done).catch(done.fail);
describe('MRWidget approvals', () => {
let wrapper;
......
......@@ -39,20 +39,10 @@ describe('Artifacts List', () => {
});
it('renders job url', () => {
expect(
wrapper
.findAll(GlLink)
.at(1)
.attributes('href'),
).toEqual(data.artifacts[0].job_path);
expect(wrapper.findAll(GlLink).at(1).attributes('href')).toEqual(data.artifacts[0].job_path);
});
it('renders job name', () => {
expect(
wrapper
.findAll(GlLink)
.at(1)
.text(),
).toEqual(data.artifacts[0].job_name);
expect(wrapper.findAll(GlLink).at(1).text()).toEqual(data.artifacts[0].job_name);
});
});
......@@ -65,18 +65,8 @@ describe('Merge Request Collapsible Extension', () => {
});
it('renders the buttons disabled', () => {
expect(
wrapper
.findAll('button')
.at(0)
.attributes('disabled'),
).toEqual('disabled');
expect(
wrapper
.findAll('button')
.at(1)
.attributes('disabled'),
).toEqual('disabled');
expect(wrapper.findAll('button').at(0).attributes('disabled')).toEqual('disabled');
expect(wrapper.findAll('button').at(1).attributes('disabled')).toEqual('disabled');
});
it('renders loading spinner', () => {
......
......@@ -72,21 +72,13 @@ describe('MRWidgetPipeline', () => {
});
it('should render pipeline ID', () => {
expect(
findPipelineID()
.text()
.trim(),
).toBe(`#${mockData.pipeline.id}`);
expect(findPipelineID().text().trim()).toBe(`#${mockData.pipeline.id}`);
});
it('should render pipeline status and commit id', () => {
expect(findPipelineInfoContainer().text()).toMatch(mockData.pipeline.details.status.label);
expect(
findCommitLink()
.text()
.trim(),
).toBe(mockData.pipeline.commit.short_id);
expect(findCommitLink().text().trim()).toBe(mockData.pipeline.commit.short_id);
expect(findCommitLink().attributes('href')).toBe(mockData.pipeline.commit.commit_path);
});
......@@ -148,11 +140,7 @@ describe('MRWidgetPipeline', () => {
});
it('should render pipeline ID', () => {
expect(
findPipelineID()
.text()
.trim(),
).toBe(`#${mockData.pipeline.id}`);
expect(findPipelineID().text().trim()).toBe(`#${mockData.pipeline.id}`);
});
it('should render pipeline status', () => {
......
......@@ -39,10 +39,7 @@ describe('MRWidgetClosed', () => {
it('renders closed by information with author and time', () => {
expect(
vm.$el
.querySelector('.js-mr-widget-author')
.textContent.trim()
.replace(/\s\s+/g, ' '),
vm.$el.querySelector('.js-mr-widget-author').textContent.trim().replace(/\s\s+/g, ' '),
).toContain('Closed by Administrator less than a minute ago');
});
......@@ -54,10 +51,7 @@ describe('MRWidgetClosed', () => {
it('renders information about the changes not being merged', () => {
expect(
vm.$el
.querySelector('.mr-info-list')
.textContent.trim()
.replace(/\s\s+/g, ' '),
vm.$el.querySelector('.mr-info-list').textContent.trim().replace(/\s\s+/g, ' '),
).toContain('The changes were not merged into so_long_jquery');
});
......
......@@ -167,12 +167,9 @@ describe('MRWidgetConflicts', () => {
},
});
expect(
vm
.text()
.trim()
.replace(/\s\s+/g, ' '),
).toContain('ask someone with write access');
expect(vm.text().trim().replace(/\s\s+/g, ' ')).toContain(
'ask someone with write access',
);
});
it('should not have action buttons', async () => {
......
......@@ -480,7 +480,10 @@ describe('ReadyToMerge', () => {
jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged'));
jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {});
vm.handleMergePolling(() => {}, () => {});
vm.handleMergePolling(
() => {},
() => {},
);
setImmediate(() => {
const statusBox = document.querySelector('.status-box');
......@@ -496,7 +499,10 @@ describe('ReadyToMerge', () => {
jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged'));
jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {});
vm.handleMergePolling(() => {}, () => {});
vm.handleMergePolling(
() => {},
() => {},
);
setImmediate(() => {
expect(document.querySelector('.js-merge-counter').textContent).toBe('0');
......@@ -657,10 +663,7 @@ describe('ReadyToMerge', () => {
const findCommitsHeaderElement = () => wrapper.find(CommitsHeader);
const findCommitEditElements = () => wrapper.findAll(CommitEdit);
const findCommitDropdownElement = () => wrapper.find(CommitMessageDropdown);
const findFirstCommitEditLabel = () =>
findCommitEditElements()
.at(0)
.props('label');
const findFirstCommitEditLabel = () => findCommitEditElements().at(0).props('label');
describe('squash checkbox', () => {
it('should be rendered when squash before merge is enabled and there is more than 1 commit', () => {
......
......@@ -194,7 +194,10 @@ export default {
updated_at: '2017-04-07T15:28:44.800Z',
},
pipelineCoverageDelta: '15.25',
buildsWithCoverage: [{ name: 'karma', coverage: '40.2' }, { name: 'rspec', coverage: '80.4' }],
buildsWithCoverage: [
{ name: 'karma', coverage: '40.2' },
{ name: 'rspec', coverage: '80.4' },
],
work_in_progress: false,
source_branch_exists: false,
mergeable_discussions_state: true,
......
......@@ -50,19 +50,11 @@ describe('MRWidgetHowToMerge', () => {
it('should render different instructions based on if the user can merge', () => {
mountComponent({ props: { canMerge: true } });
expect(
findInstructionsFields()
.at(2)
.text(),
).toContain('git push origin');
expect(findInstructionsFields().at(2).text()).toContain('git push origin');
});
it('should render different instructions based on if the merge is based off a fork', () => {
mountComponent({ props: { isFork: true } });
expect(
findInstructionsFields()
.at(0)
.text(),
).toContain('FETCH_HEAD');
expect(findInstructionsFields().at(0).text()).toContain('FETCH_HEAD');
});
});
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