Commit 38a4febd authored by Mehmet Emin INAC's avatar Mehmet Emin INAC Committed by Simon Knox

Fix accessing the errors property of the scan objects

Changelog: fixed
EE: true
parent 1b36def8
......@@ -66,7 +66,7 @@ export default {
};
},
scansWithErrors() {
const getScans = (reportSummary) => reportSummary?.scans || [];
const getScans = (reportSummary) => reportSummary?.scans?.nodes || [];
const hasErrors = (scan) => Boolean(scan.errors?.length);
return this.securityReportSummary
......
......@@ -153,23 +153,29 @@ describe('Pipeline Security Dashboard component', () => {
const securityReportSummary = {
scanner_1: {
// this scan contains errors
scans: [
scans: {
nodes: [
{ errors: ['scanner 1 - error 1', 'scanner 1 - error 2'], name: 'foo' },
{ errors: ['scanner 1 - error 3', 'scanner 1 - error 4'], name: 'bar' },
],
},
},
scanner_2: null,
scanner_3: {
// this scan contains errors
scans: [{ errors: ['scanner 3 - error 1', 'scanner 3 - error 2'], name: 'baz' }],
scans: {
nodes: [{ errors: ['scanner 3 - error 1', 'scanner 3 - error 2'], name: 'baz' }],
},
},
scanner_4: {
scans: [{ errors: [], name: 'quz' }],
scans: {
nodes: [{ errors: [], name: 'quz' }],
},
},
};
const scansWithErrors = [
...securityReportSummary.scanner_1.scans,
...securityReportSummary.scanner_3.scans,
...securityReportSummary.scanner_1.scans.nodes,
...securityReportSummary.scanner_3.scans.nodes,
];
beforeEach(() => {
......
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