Commit 07d90dbe authored by Filipa Lacerda's avatar Filipa Lacerda

Improve wording in reports in MR widget

parent d7b67f69
...@@ -115,39 +115,39 @@ export default { ...@@ -115,39 +115,39 @@ export default {
securityText() { securityText() {
if (this.mr.securityReport.length) { if (this.mr.securityReport.length) {
return n__( return n__(
'%d security vulnerability detected', 'SAST detected %d security vulnerability',
'%d security vulnerabilities detected', 'SAST detected %d security vulnerabilities',
this.mr.securityReport.length, this.mr.securityReport.length,
); );
} }
return 'No security vulnerabilities detected'; return 'SAST no security vulnerabilities detected';
}, },
dockerText() { dockerText() {
const { vulnerabilities, approved, unapproved } = this.mr.dockerReport; const { vulnerabilities, approved, unapproved } = this.mr.dockerReport;
if (!vulnerabilities.length) { if (!vulnerabilities.length) {
return s__('ciReport|No vulnerabilities were found'); return s__('ciReport|SAST:container no vulnerabilities were found');
} }
if (!unapproved.length && approved.length) { if (!unapproved.length && approved.length) {
return n__( return n__(
'Found %d approved vulnerability', 'SAST:container found %d approved vulnerability',
'Found %d approved vulnerabilities', 'SAST:container found %d approved vulnerabilities',
approved.length, approved.length,
); );
} else if (unapproved.length && !approved.length) { } else if (unapproved.length && !approved.length) {
return n__( return n__(
'Found %d vulnerability', 'SAST:container found %d vulnerability',
'Found %d vulnerabilities', 'SAST:container found %d vulnerabilities',
unapproved.length, unapproved.length,
); );
} }
return `${n__( return `${n__(
'Found %d vulnerability,', 'SAST:container found %d vulnerability,',
'Found %d vulnerabilities,', 'SAST:container found %d vulnerabilities,',
vulnerabilities.length, vulnerabilities.length,
)} ${n__( )} ${n__(
'of which %d is approved', 'of which %d is approved',
...@@ -159,13 +159,13 @@ export default { ...@@ -159,13 +159,13 @@ export default {
dastText() { dastText() {
if (this.mr.dastReport.length) { if (this.mr.dastReport.length) {
return n__( return n__(
'%d DAST alert detected by analyzing the review app', 'DAST detected%d alert by analyzing the review app',
'%d DAST alerts detected by analyzing the review app', 'DAST detected %d alerts by analyzing the review app',
this.mr.dastReport.length, this.mr.dastReport.length,
); );
} }
return s__('ciReport|No DAST alerts detected by analyzing the review app'); return s__('ciReport|DAST no alerts detected by analyzing the review app');
}, },
codequalityStatus() { codequalityStatus() {
......
...@@ -71,7 +71,7 @@ describe('ee merge request widget options', () => { ...@@ -71,7 +71,7 @@ describe('ee merge request widget options', () => {
setTimeout(() => { setTimeout(() => {
expect( expect(
vm.$el.querySelector('.js-sast-widget .js-code-text').textContent.trim(), vm.$el.querySelector('.js-sast-widget .js-code-text').textContent.trim(),
).toEqual('2 security vulnerabilities detected'); ).toEqual('SAST detected 2 security vulnerabilities');
done(); done();
}, 0); }, 0);
}); });
...@@ -94,7 +94,7 @@ describe('ee merge request widget options', () => { ...@@ -94,7 +94,7 @@ describe('ee merge request widget options', () => {
setTimeout(() => { setTimeout(() => {
expect( expect(
vm.$el.querySelector('.js-sast-widget .js-code-text').textContent.trim(), vm.$el.querySelector('.js-sast-widget .js-code-text').textContent.trim(),
).toEqual('No security vulnerabilities detected'); ).toEqual('SAST no security vulnerabilities detected');
done(); done();
}, 0); }, 0);
}); });
...@@ -408,7 +408,7 @@ describe('ee merge request widget options', () => { ...@@ -408,7 +408,7 @@ describe('ee merge request widget options', () => {
setTimeout(() => { setTimeout(() => {
expect( expect(
vm.$el.querySelector('.js-docker-widget .js-code-text').textContent.trim(), vm.$el.querySelector('.js-docker-widget .js-code-text').textContent.trim(),
).toEqual('Found 3 vulnerabilities, of which 1 is approved'); ).toEqual('SAST:container found 3 vulnerabilities, of which 1 is approved');
vm.$el.querySelector('.js-docker-widget button').click(); vm.$el.querySelector('.js-docker-widget button').click();
...@@ -494,7 +494,7 @@ describe('ee merge request widget options', () => { ...@@ -494,7 +494,7 @@ describe('ee merge request widget options', () => {
setTimeout(() => { setTimeout(() => {
expect( expect(
vm.$el.querySelector('.js-dast-widget .js-code-text').textContent.trim(), vm.$el.querySelector('.js-dast-widget .js-code-text').textContent.trim(),
).toEqual('2 DAST alerts detected by analyzing the review app'); ).toEqual('DAST detected 2 alerts by analyzing the review app');
vm.$el.querySelector('.js-dast-widget button').click(); vm.$el.querySelector('.js-dast-widget button').click();
...@@ -585,7 +585,7 @@ describe('ee merge request widget options', () => { ...@@ -585,7 +585,7 @@ describe('ee merge request widget options', () => {
describe('with no vulnerabilities', () => { describe('with no vulnerabilities', () => {
it('returns No vulnerabilities found', () => { it('returns No vulnerabilities found', () => {
expect(vm.dockerText).toEqual('No vulnerabilities were found'); expect(vm.dockerText).toEqual('SAST:container no vulnerabilities were found');
}); });
}); });
...@@ -604,7 +604,7 @@ describe('ee merge request widget options', () => { ...@@ -604,7 +604,7 @@ describe('ee merge request widget options', () => {
}], }],
unapproved: [], unapproved: [],
}; };
expect(vm.dockerText).toEqual('Found 1 approved vulnerability'); expect(vm.dockerText).toEqual('SAST:container found 1 approved vulnerability');
}); });
it('returns approved information - plural', () => { it('returns approved information - plural', () => {
...@@ -628,7 +628,7 @@ describe('ee merge request widget options', () => { ...@@ -628,7 +628,7 @@ describe('ee merge request widget options', () => {
], ],
unapproved: [], unapproved: [],
}; };
expect(vm.dockerText).toEqual('Found 2 approved vulnerabilities'); expect(vm.dockerText).toEqual('SAST:container found 2 approved vulnerabilities');
}); });
}); });
...@@ -649,7 +649,7 @@ describe('ee merge request widget options', () => { ...@@ -649,7 +649,7 @@ describe('ee merge request widget options', () => {
], ],
approved: [], approved: [],
}; };
expect(vm.dockerText).toEqual('Found 1 vulnerability'); expect(vm.dockerText).toEqual('SAST:container found 1 vulnerability');
}); });
it('returns number of vulnerabilities - plural', () => { it('returns number of vulnerabilities - plural', () => {
...@@ -673,7 +673,7 @@ describe('ee merge request widget options', () => { ...@@ -673,7 +673,7 @@ describe('ee merge request widget options', () => {
], ],
approved: [], approved: [],
}; };
expect(vm.dockerText).toEqual('Found 2 vulnerabilities'); expect(vm.dockerText).toEqual('SAST:container found 2 vulnerabilities');
}); });
}); });
...@@ -701,7 +701,7 @@ describe('ee merge request widget options', () => { ...@@ -701,7 +701,7 @@ describe('ee merge request widget options', () => {
], ],
}; };
expect(vm.dockerText).toEqual('Found 1 vulnerability, of which 1 is approved'); expect(vm.dockerText).toEqual('SAST:container found 1 vulnerability, of which 1 is approved');
}); });
it('returns message with information about both - plural', () => { it('returns message with information about both - plural', () => {
...@@ -743,7 +743,7 @@ describe('ee merge request widget options', () => { ...@@ -743,7 +743,7 @@ describe('ee merge request widget options', () => {
}, },
], ],
}; };
expect(vm.dockerText).toEqual('Found 2 vulnerabilities, of which 2 are approved'); expect(vm.dockerText).toEqual('SAST:container found 2 vulnerabilities, of which 2 are approved');
}); });
}); });
}); });
......
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