Commit 1d0b0975 authored by Alexander Turinske's avatar Alexander Turinske

Add check for empty identifiers array

- add additional test data for this case
parent 8eaed8ff
...@@ -211,6 +211,9 @@ export default { ...@@ -211,6 +211,9 @@ export default {
return acc; return acc;
}, {}); }, {});
}, },
shouldShowExtraIdentifierCount(identifiers) {
return identifiers?.length > 1;
},
shouldShowVulnerabilityPath(item) { shouldShowVulnerabilityPath(item) {
return Boolean(item.location.image || item.location.file); return Boolean(item.location.image || item.location.file);
}, },
...@@ -338,7 +341,7 @@ export default { ...@@ -338,7 +341,7 @@ export default {
{{ primaryIdentifier(item.identifiers) }} {{ primaryIdentifier(item.identifiers) }}
</div> </div>
<div <div
v-if="extraIdentifierCount(item.identifiers)" v-if="shouldShowExtraIdentifierCount(item.identifiers)"
data-testid="vulnerability-more-identifiers" data-testid="vulnerability-more-identifiers"
class="gl-text-gray-500" class="gl-text-gray-500"
> >
......
...@@ -51,6 +51,7 @@ export const generateVulnerabilities = () => [ ...@@ -51,6 +51,7 @@ export const generateVulnerabilities = () => [
}, },
{ {
id: 'id_2', id: 'id_2',
identifiers: [],
title: 'Vulnerability 2', title: 'Vulnerability 2',
severity: 'high', severity: 'high',
state: 'opened', state: 'opened',
......
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