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