Commit b1089f78 authored by Olivier Gonzalez's avatar Olivier Gonzalez Committed by Filipa Lacerda

Ensure Severity and Confidence are displayed independently for SAST vulnerabilities.

parent f1436a2e
...@@ -28,6 +28,12 @@ export default { ...@@ -28,6 +28,12 @@ export default {
<template v-if="issue.severity && issue.confidence"> <template v-if="issue.severity && issue.confidence">
{{ issue.severity }} ({{ issue.confidence }}): {{ issue.severity }} ({{ issue.confidence }}):
</template> </template>
<template v-else-if="issue.severity">
{{ issue.severity }}:
</template>
<template v-else-if="issue.confidence">
({{ issue.confidence }}):
</template>
<template v-else-if="issue.priority">{{ issue.priority }}:</template> <template v-else-if="issue.priority">{{ issue.priority }}:</template>
<modal-open-name :issue="issue" /> <modal-open-name :issue="issue" />
......
...@@ -33,21 +33,31 @@ describe('sast issue body', () => { ...@@ -33,21 +33,31 @@ describe('sast issue body', () => {
issue: sastIssue, issue: sastIssue,
}); });
expect(vm.$el.textContent.trim()).toContain(`${sastIssue.severity} (${sastIssue.confidence})`); expect(vm.$el.textContent.trim()).toContain(`${sastIssue.severity} (${sastIssue.confidence}):`);
}); });
}); });
describe('without severity', () => { describe('with severity and without confidence (new json format)', () => {
it('does not render severity nor confidence', () => { it('renders severity only', () => {
const issueCopy = Object.assign({}, sastIssue); const issueCopy = Object.assign({}, sastIssue);
delete issueCopy.severity; delete issueCopy.confidence;
vm = mountComponent(Component, {
issue: issueCopy,
});
expect(vm.$el.textContent.trim()).toContain(`${issueCopy.severity}:`);
});
});
describe('with confidence and without severity (new json format)', () => {
it('renders confidence only', () => {
const issueCopy = Object.assign({}, sastIssue);
delete issueCopy.severity;
vm = mountComponent(Component, { vm = mountComponent(Component, {
issue: issueCopy, issue: issueCopy,
}); });
expect(vm.$el.textContent.trim()).not.toContain(sastIssue.severity); expect(vm.$el.textContent.trim()).toContain(`(${issueCopy.confidence}):`);
expect(vm.$el.textContent.trim()).not.toContain(sastIssue.confidence);
}); });
}); });
......
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