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