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