Commit da4eea76 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 25 spec files: 4 of 10

Mandatory not to break master. Automatically created with prettier.
parent 8ac8a1f2
......@@ -11,18 +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/security_dashboard/components
ee/spec/frontend/security_dashboard/store/modules/project_selector
ee/spec/frontend/sidebar/components
ee/spec/frontend/storage_counter/components
ee/spec/frontend/subscriptions/new/components
ee/spec/frontend/threat_monitoring
ee/spec/frontend/vue_mr_widget
ee/spec/frontend/vue_shared/components/sidebar/epics_select
ee/spec/frontend/vue_shared/license_compliance/components
ee/spec/frontend/vue_shared/license_compliance/store
ee/spec/frontend/vue_shared/security_reports/components
ee/spec/frontend/vulnerabilities
spec/frontend/alert_management/components
spec/frontend/alerts_settings
spec/frontend/authentication/u2f
......
......@@ -60,11 +60,7 @@ describe('Project List component', () => {
it('renders a project-item with an avatar', () => {
factory({ projects: generateMockProjects(1) });
expect(
getFirstProjectItem()
.find(ProjectAvatar)
.exists(),
).toBe(true);
expect(getFirstProjectItem().find(ProjectAvatar).exists()).toBe(true);
});
it('renders a project-item with a project name', () => {
......
......@@ -9,7 +9,10 @@ localVue.use(Vuex);
describe('Filter component', () => {
const projectId = 1;
const jobs = [{ ref: 'master', name: 'fuzz' }, { ref: 'master', name: 'fuzz 2' }];
const jobs = [
{ ref: 'master', name: 'fuzz' },
{ ref: 'master', name: 'fuzz 2' },
];
let wrapper;
let store;
......
......@@ -76,11 +76,7 @@ describe('Security Dashboard Table Row', () => {
});
it('should render the severity', () => {
expect(
findContent(0)
.text()
.toLowerCase(),
).toContain(vulnerability.severity);
expect(findContent(0).text().toLowerCase()).toContain(vulnerability.severity);
});
it('should render the identifier cell', () => {
......@@ -90,11 +86,9 @@ describe('Security Dashboard Table Row', () => {
});
it('should render the report type', () => {
expect(
findContent(3)
.text()
.toLowerCase(),
).toContain(vulnerability.report_type.toLowerCase());
expect(findContent(3).text().toLowerCase()).toContain(
vulnerability.report_type.toLowerCase(),
);
});
it('should render the scanner vendor if the scanner does exist', () => {
......
......@@ -63,9 +63,7 @@ describe('Selection Summary component', () => {
expect(wrapper.vm.dismissalReason).toBe(null);
expect(wrapper.findAll('option')).toHaveLength(4);
const option = formSelect()
.findAll('option')
.at(1);
const option = formSelect().findAll('option').at(1);
option.setSelected();
formSelect().trigger('change');
......
......@@ -90,9 +90,7 @@ describe('Selection Summary', () => {
selectByIndex(0);
const option = formSelect()
.findAll('option')
.at(1);
const option = formSelect().findAll('option').at(1);
option.setSelected();
formSelect().trigger('change');
......@@ -108,9 +106,7 @@ describe('Selection Summary', () => {
selectByIndex(0);
selectByIndex(1);
const option = formSelect()
.findAll('option')
.at(1);
const option = formSelect().findAll('option').at(1);
option.setSelected();
formSelect().trigger('change');
......
......@@ -86,7 +86,10 @@ describe('EE projectSelector actions', () => {
it(`posts the selected project's ids to the add-endpoint`, () => {
const projectIds = ['1', '2'];
state.selectedProjects = [{ id: projectIds[0], name: '1' }, { id: projectIds[1], name: '2' }];
state.selectedProjects = [
{ id: projectIds[0], name: '1' },
{ id: projectIds[1], name: '2' },
];
state.projectEndpoints.add = mockAddEndpoint;
mockAxios.onPost(mockAddEndpoint).replyOnce(200, mockResponse);
......
......@@ -200,7 +200,10 @@ describe('IterationSelect', () => {
beforeEach(() => {
createComponent({
data: {
iterations: [{ id: 'id', title: 'title' }, { id: '123', title: '123' }],
iterations: [
{ id: 'id', title: 'title' },
{ id: '123', title: '123' },
],
currentIteration: '123',
},
});
......@@ -229,7 +232,10 @@ describe('IterationSelect', () => {
const bootstrapComponent = mutationResp => {
createComponent({
data: {
iterations: [{ id: '123', title: '123' }, { id: 'id', title: 'title' }],
iterations: [
{ id: '123', title: '123' },
{ id: 'id', title: 'title' },
],
currentIteration: '123',
},
mutationPromise: mutationResp,
......
......@@ -222,11 +222,7 @@ describe('Status', () => {
it('shows text to ask the user to pick an option', () => {
const message = 'Assign health status';
expect(
getDropdownElement(wrapper)
.find('.health-title')
.text(),
).toContain(message);
expect(getDropdownElement(wrapper).find('.health-title').text()).toContain(message);
});
it('hides form when the `edit` button is clicked', async () => {
......
......@@ -45,9 +45,7 @@ describe('Usage Statistics component', () => {
it('renders text in total usage card footer', () => {
expect(
getStatisticsCard('totalUsage')
.find('[data-testid="statisticsCardFooter"]')
.text(),
getStatisticsCard('totalUsage').find('[data-testid="statisticsCardFooter"]').text(),
).toMatchInterpolatedText(
'This is the total amount of storage used across your projects within this namespace.',
);
......@@ -55,20 +53,14 @@ describe('Usage Statistics component', () => {
it('renders text in excess usage card footer', () => {
expect(
getStatisticsCard('excessUsage')
.find('[data-testid="statisticsCardFooter"]')
.text(),
getStatisticsCard('excessUsage').find('[data-testid="statisticsCardFooter"]').text(),
).toMatchInterpolatedText(
'This is the total amount of storage used by projects above the free 978.8KiB storage limit.',
);
});
it('renders button in purchased usage card footer', () => {
expect(
getStatisticsCard('purchasedUsage')
.find(GlButton)
.exists(),
).toBe(true);
expect(getStatisticsCard('purchasedUsage').find(GlButton).exists()).toBe(true);
});
});
......
......@@ -56,12 +56,9 @@ describe('Payment Method', () => {
describe('showing the summary', () => {
it('should show the entered credit card details', () => {
expect(
wrapper
.find('.js-summary-line-1')
.html()
.replace(/\s+/g, ' '),
).toContain('Visa ending in <strong>4242</strong>');
expect(wrapper.find('.js-summary-line-1').html().replace(/\s+/g, ' ')).toContain(
'Visa ending in <strong>4242</strong>',
);
});
it('should show the entered credit card expiration date', () => {
......
......@@ -28,7 +28,10 @@ describe('Checkout', () => {
wrapper.destroy();
});
describe.each([[true, true], [false, false]])('when isNewUser=%s', (isNewUser, visible) => {
describe.each([
[true, true],
[false, false],
])('when isNewUser=%s', (isNewUser, visible) => {
beforeEach(() => {
store.state.isNewUser = isNewUser;
});
......
......@@ -129,9 +129,7 @@ spec:
});
it('renders policies table', () => {
const namespaceHeader = findPoliciesTable()
.findAll('[role="columnheader"]')
.at(1);
const namespaceHeader = findPoliciesTable().findAll('[role="columnheader"]').at(1);
expect(namespaceHeader.text()).toBe('Namespace');
});
});
......@@ -143,9 +141,7 @@ spec:
});
it('renders opened editor drawer on row selection', () => {
findPoliciesTable()
.find('td')
.trigger('click');
findPoliciesTable().find('td').trigger('click');
return wrapper.vm.$nextTick().then(() => {
const editorDrawer = findEditorDrawer();
......
......@@ -37,9 +37,7 @@ describe('PolicyRuleBuilder component', () => {
function selectFirstOption(sel) {
const el = wrapper.find(sel);
el.findAll('option')
.at(1)
.setSelected();
el.findAll('option').at(1).setSelected();
el.trigger('change');
}
......
......@@ -66,14 +66,23 @@ export const mockNetworkPolicyStatisticsResponse = {
drops: 84,
},
ops_rate: {
total: [[1575417600, 56], [1575504000, 2647]],
drops: [[1575417600, 1], [1575504000, 83]],
total: [
[1575417600, 56],
[1575504000, 2647],
],
drops: [
[1575417600, 1],
[1575504000, 83],
],
},
};
export const formattedMockNetworkPolicyStatisticsResponse = {
opsRate: {
drops: [[new Date('2019-12-04T00:00:00.000Z'), 1], [new Date('2019-12-05T00:00:00.000Z'), 83]],
drops: [
[new Date('2019-12-04T00:00:00.000Z'), 1],
[new Date('2019-12-05T00:00:00.000Z'), 83],
],
total: [
[new Date('2019-12-04T00:00:00.000Z'), 56],
[new Date('2019-12-05T00:00:00.000Z'), 2647],
......
......@@ -6,10 +6,7 @@ const TEST_PASSWORD = 'password';
// For some reason, the `Promise.resolve` needs to be deferred
// or the timing doesn't work.
const waitForTick = done =>
Promise.resolve()
.then(done)
.catch(done.fail);
const waitForTick = done => Promise.resolve().then(done).catch(done.fail);
describe('Approval auth component', () => {
let wrapper;
......
......@@ -130,20 +130,14 @@ describe('Visual Review App Link', () => {
});
it('with review app split dropdown', () => {
expect(
wrapper
.find(GlDropdown)
.find(`a[href='${propsData.link}']`)
.exists(),
).toEqual(true);
expect(wrapper.find(GlDropdown).find(`a[href='${propsData.link}']`).exists()).toEqual(
true,
);
});
it('contains a list of changed pages', () => {
expect(
wrapper
.find(GlDropdown)
.find(`a[href='${propsData.link}/example-path']`)
.exists(),
wrapper.find(GlDropdown).find(`a[href='${propsData.link}/example-path']`).exists(),
).toEqual(true);
});
......
......@@ -127,9 +127,7 @@ describe('ee merge request widget options', () => {
it('should render loading indicator', () => {
expect(
findExtendedSecurityWidget()
.querySelector(SAST_SELECTOR)
.textContent.trim(),
findExtendedSecurityWidget().querySelector(SAST_SELECTOR).textContent.trim(),
).toContain('SAST is loading');
});
});
......@@ -725,9 +723,7 @@ describe('ee merge request widget options', () => {
it('should render loading indicator', () => {
expect(
findExtendedSecurityWidget()
.querySelector(DAST_SELECTOR)
.textContent.trim(),
findExtendedSecurityWidget().querySelector(DAST_SELECTOR).textContent.trim(),
).toContain('DAST is loading');
});
});
......@@ -765,9 +761,7 @@ describe('ee merge request widget options', () => {
it('should render error indicator', done => {
setImmediate(() => {
expect(
findExtendedSecurityWidget()
.querySelector(DAST_SELECTOR)
.textContent.trim(),
findExtendedSecurityWidget().querySelector(DAST_SELECTOR).textContent.trim(),
).toContain('DAST: Loading resulted in an error');
done();
});
......@@ -804,9 +798,7 @@ describe('ee merge request widget options', () => {
vm = mountWithFeatureFlag();
expect(
findExtendedSecurityWidget()
.querySelector(COVERAGE_FUZZING_SELECTOR)
.textContent.trim(),
findExtendedSecurityWidget().querySelector(COVERAGE_FUZZING_SELECTOR).textContent.trim(),
).toContain('Coverage fuzzing is loading');
});
});
......@@ -922,9 +914,7 @@ describe('ee merge request widget options', () => {
it('should render error indicator', done => {
setImmediate(() => {
expect(
findExtendedSecurityWidget()
.querySelector(SECRET_SCANNING_SELECTOR)
.textContent.trim(),
findExtendedSecurityWidget().querySelector(SECRET_SCANNING_SELECTOR).textContent.trim(),
).toContain('Secret scanning: Loading resulted in an error');
done();
});
......@@ -994,9 +984,7 @@ describe('ee merge request widget options', () => {
it('should render error indicator', done => {
setImmediate(() => {
expect(
findExtendedSecurityWidget()
.querySelector(API_FUZZING_SELECTOR)
.textContent.trim(),
findExtendedSecurityWidget().querySelector(API_FUZZING_SELECTOR).textContent.trim(),
).toContain('API fuzzing: Loading resulted in an error');
done();
});
......
......@@ -92,24 +92,9 @@ describe('EpicsSelect', () => {
expect(epicsEl).toHaveLength(epics.length + 2); // includes divider & No Epic` <li>.
expect(epicsEl.at(1).classes()).toContain('divider');
expect(
epicsEl
.at(2)
.find(GlLink)
.text(),
).toBe(epics[0].title);
expect(
epicsEl
.at(3)
.find(GlLink)
.text(),
).toBe(epics[1].title);
expect(
epicsEl
.at(2)
.find(GlLink)
.classes(),
).toContain('is-active');
expect(epicsEl.at(2).find(GlLink).text()).toBe(epics[0].title);
expect(epicsEl.at(3).find(GlLink).text()).toBe(epics[1].title);
expect(epicsEl.at(2).find(GlLink).classes()).toContain('is-active');
});
it('should render string "No matches found" when `epics` array is empty', () => {
......
......@@ -25,9 +25,7 @@ describe('AddLicenseFormDropdown', () => {
jest.spyOn(vm, '$emit').mockImplementation(() => {});
$(vm.$el)
.val('LGPL')
.trigger('change');
$(vm.$el).val('LGPL').trigger('change');
expect(vm.$emit).toHaveBeenCalledWith('input', 'LGPL');
});
......
......@@ -370,9 +370,7 @@ describe('License store actions', () => {
});
it('does not dispatch setLicenseApproval for approved licenses', done => {
testAction(actions.allowLicense, approvedLicense, state, [], [])
.then(done)
.catch(done.fail);
testAction(actions.allowLicense, approvedLicense, state, [], []).then(done).catch(done.fail);
});
});
......
......@@ -77,10 +77,6 @@ describe('Split Button', () => {
buttons: buttons.slice(0),
});
expect(
findDropdownItems()
.at(0)
.props('isChecked'),
).toBe(true);
expect(findDropdownItems().at(0).props('isChecked')).toBe(true);
});
});
......@@ -173,7 +173,10 @@ describe('VulnerabilityDetails component', () => {
request: {
method: 'GET',
url: 'http://foo.bar/path',
headers: [{ name: 'key1', value: 'value1' }, { name: 'key2', value: 'value2' }],
headers: [
{ name: 'key1', value: 'value1' },
{ name: 'key2', value: 'value2' },
],
},
});
componentFactory(vulnerability);
......@@ -225,7 +228,10 @@ describe('VulnerabilityDetails component', () => {
response: {
status_code: '200',
reason_phrase: 'INTERNAL SERVER ERROR',
headers: [{ name: 'key1', value: 'value1' }, { name: 'key2', value: 'value2' }],
headers: [
{ name: 'key1', value: 'value1' },
{ name: 'key2', value: 'value2' },
],
},
});
componentFactory(vulnerability);
......@@ -267,7 +273,10 @@ describe('VulnerabilityDetails component', () => {
response: {
status_code: '200',
reason_phrase: 'INTERNAL SERVER ERROR',
headers: [{ name: 'key1', value: 'value1' }, { name: 'key2', value: 'value2' }],
headers: [
{ name: 'key1', value: 'value1' },
{ name: 'key2', value: 'value2' },
],
},
},
],
......@@ -312,11 +321,7 @@ describe('VulnerabilityDetails component', () => {
});
it('should render link', () => {
expect(
findLink('scanner')
.find('a')
.exists(),
).toBe(true);
expect(findLink('scanner').find('a').exists()).toBe(true);
});
});
......@@ -351,11 +356,17 @@ describe('VulnerabilityDetails component', () => {
makeVulnerability({
request: {
url: 'http://foo.bar/path',
headers: [{ name: 'key1', value: 'value1' }, { name: 'key2', value: 'value2' }],
headers: [
{ name: 'key1', value: 'value1' },
{ name: 'key2', value: 'value2' },
],
},
response: {
status_code: '200',
headers: [{ name: 'key1', value: 'value1' }, { name: 'key2', value: 'value2' }],
headers: [
{ name: 'key1', value: 'value1' },
{ name: 'key2', value: 'value2' },
],
},
}),
);
......
......@@ -190,7 +190,10 @@ describe('Vulnerability Details', () => {
});
describe('http data', () => {
const TEST_HEADERS = [{ name: 'Name1', value: 'Value1' }, { name: 'Name2', value: 'Value2' }];
const TEST_HEADERS = [
{ name: 'Name1', value: 'Value1' },
{ name: 'Name2', value: 'Value2' },
];
const EXPECT_REQUEST = {
label: 'Sent request:',
content: 'GET http://www.gitlab.com\nName1: Value1\nName2: Value2\n\n[{"user_id":1,}]',
......
......@@ -110,7 +110,10 @@ describe('Vulnerability Footer', () => {
it('renders the history list if there are history items', () => {
// The shape of this object doesn't matter for this test, we just need to verify that it's passed to the history
// entry.
const historyItems = [{ id: 1, note: 'some note' }, { id: 2, note: 'another note' }];
const historyItems = [
{ id: 1, note: 'some note' },
{ id: 2, note: 'another note' },
];
mockAxios.onGet(discussionUrl).replyOnce(200, historyItems, { date: Date.now() });
createWrapper();
......
......@@ -2,9 +2,10 @@ import { getFormattedIssue, getAddRelatedIssueRequestParams } from 'ee/vulnerabi
describe('Vulnerabilities helpers', () => {
describe('getFormattedIssue', () => {
it.each([{ iid: 135, web_url: 'some/url' }, { iid: undefined, web_url: undefined }])(
'returns formatted issue with expected properties for issue %s',
issue => {
it.each([
{ iid: 135, web_url: 'some/url' },
{ iid: undefined, web_url: undefined },
])('returns formatted issue with expected properties for issue %s', issue => {
const formattedIssue = getFormattedIssue(issue);
expect(formattedIssue).toMatchObject({
......@@ -12,8 +13,7 @@ describe('Vulnerabilities helpers', () => {
reference: `#${issue.iid}`,
path: issue.web_url,
});
},
);
});
});
describe('getAddRelatedIssueRequestParams', () => {
......
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