diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/frontend/reports/codequality_report/store/utils/codequality_comparison_spec.js | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/frontend/reports/codequality_report/store/utils/codequality_comparison_spec.js')
-rw-r--r-- | spec/frontend/reports/codequality_report/store/utils/codequality_comparison_spec.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/frontend/reports/codequality_report/store/utils/codequality_comparison_spec.js b/spec/frontend/reports/codequality_report/store/utils/codequality_comparison_spec.js index 085d697672d..389e9b4a1f6 100644 --- a/spec/frontend/reports/codequality_report/store/utils/codequality_comparison_spec.js +++ b/spec/frontend/reports/codequality_report/store/utils/codequality_comparison_spec.js @@ -2,7 +2,13 @@ import { parseCodeclimateMetrics, doCodeClimateComparison, } from '~/reports/codequality_report/store/utils/codequality_comparison'; -import { baseIssues, mockParsedHeadIssues, mockParsedBaseIssues } from '../../mock_data'; +import { + baseIssues, + mockParsedHeadIssues, + mockParsedBaseIssues, + reportIssues, + parsedReportIssues, +} from '../../mock_data'; jest.mock('~/reports/codequality_report/workers/codequality_comparison_worker', () => { let mockPostMessageCallback; @@ -34,7 +40,7 @@ describe('Codequality report store utils', () => { let result; describe('parseCodeclimateMetrics', () => { - it('should parse the received issues', () => { + it('should parse the issues from codeclimate artifacts', () => { [result] = parseCodeclimateMetrics(baseIssues, 'path'); expect(result.name).toEqual(baseIssues[0].check_name); @@ -42,6 +48,14 @@ describe('Codequality report store utils', () => { expect(result.line).toEqual(baseIssues[0].location.lines.begin); }); + it('should parse the issues from backend codequality diff', () => { + [result] = parseCodeclimateMetrics(reportIssues.new_errors, 'path'); + + expect(result.name).toEqual(parsedReportIssues.newIssues[0].name); + expect(result.path).toEqual(parsedReportIssues.newIssues[0].path); + expect(result.line).toEqual(parsedReportIssues.newIssues[0].line); + }); + describe('when an issue has no location or path', () => { const issue = { description: 'Insecure Dependency' }; |