diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-20 18:20:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-20 18:20:09 +0300 |
commit | da23c5d563d68bfa5271b216209a7715c7ce3073 (patch) | |
tree | ea829aa79f715b98c440d6bf3767328b4fc4f750 /spec/frontend/vue_merge_request_widget | |
parent | 2366f969a4b3a95e052e551cc7283a2db8d5562e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_merge_request_widget')
-rw-r--r-- | spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js | 22 | ||||
-rw-r--r-- | spec/frontend/vue_merge_request_widget/extentions/code_quality/mock_data.js | 14 |
2 files changed, 32 insertions, 4 deletions
diff --git a/spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js b/spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js index 1478b3ac098..8d3bf3dd3be 100644 --- a/spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js +++ b/spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js @@ -185,13 +185,13 @@ describe('Code Quality extension', () => { }); it('displays all report list items in viewport', () => { - expect(findAllExtensionListItems()).toHaveLength(2); + expect(findAllExtensionListItems()).toHaveLength(4); }); it('displays report list item formatted', () => { const text = { newError: trimText(findAllExtensionListItems().at(0).text().replace(/\s+/g, ' ').trim()), - resolvedError: findAllExtensionListItems().at(1).text().replace(/\s+/g, ' ').trim(), + resolvedError: findAllExtensionListItems().at(2).text().replace(/\s+/g, ' ').trim(), }; expect(text.newError).toContain( @@ -202,9 +202,23 @@ describe('Code Quality extension', () => { ); }); + it('displays report list item formatted with check_name', () => { + const text = { + newError: trimText(findAllExtensionListItems().at(1).text().replace(/\s+/g, ' ').trim()), + resolvedError: findAllExtensionListItems().at(3).text().replace(/\s+/g, ' ').trim(), + }; + + expect(text.newError).toContain( + 'Minor - Rubocop/Metrics/ParameterLists - Avoid parameter lists longer than 5 parameters. [12/5] in main.rb:3', + ); + expect(text.resolvedError).toContain( + 'Minor - Rubocop/Metrics/ParameterLists - Avoid parameter lists longer than 5 parameters. [12/5] Fixed in main.rb:3', + ); + }); + it('adds fixed indicator (badge) when error is resolved', () => { - expect(findAllExtensionListItems().at(1).findComponent(GlBadge).exists()).toBe(true); - expect(findAllExtensionListItems().at(1).findComponent(GlBadge).text()).toEqual(i18n.fixed); + expect(findAllExtensionListItems().at(3).findComponent(GlBadge).exists()).toBe(true); + expect(findAllExtensionListItems().at(3).findComponent(GlBadge).text()).toEqual(i18n.fixed); }); it('should not add fixed indicator (badge) when error is new', () => { diff --git a/spec/frontend/vue_merge_request_widget/extentions/code_quality/mock_data.js b/spec/frontend/vue_merge_request_widget/extentions/code_quality/mock_data.js index cb23b730a93..e66c1521ff5 100644 --- a/spec/frontend/vue_merge_request_widget/extentions/code_quality/mock_data.js +++ b/spec/frontend/vue_merge_request_widget/extentions/code_quality/mock_data.js @@ -57,6 +57,13 @@ export const codeQualityResponseResolvedAndNewErrors = { file_path: 'index.js', line: 12, }, + { + description: 'Avoid parameter lists longer than 5 parameters. [12/5]', + check_name: 'Rubocop/Metrics/ParameterLists', + severity: 'minor', + file_path: 'main.rb', + line: 3, + }, ], resolved_errors: [ { @@ -65,6 +72,13 @@ export const codeQualityResponseResolvedAndNewErrors = { file_path: 'index.js', line: 12, }, + { + description: 'Avoid parameter lists longer than 5 parameters. [12/5]', + check_name: 'Rubocop/Metrics/ParameterLists', + severity: 'minor', + file_path: 'main.rb', + line: 3, + }, ], existing_errors: [], summary: { |