Commit a43773ea authored by Simon Knox's avatar Simon Knox

Merge branch 'fix_pipeline_scan_errors' into 'master'

Fix accessing the errors property of the scan objects

See merge request gitlab-org/gitlab!63808
parents 95f58cb1 38a4febd
......@@ -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: [
{ errors: ['scanner 1 - error 1', 'scanner 1 - error 2'], name: 'foo' },
{ errors: ['scanner 1 - error 3', 'scanner 1 - error 4'], name: 'bar' },
],
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