diff options
Diffstat (limited to 'spec/frontend/vue_merge_request_widget/extentions')
4 files changed, 35 insertions, 10 deletions
diff --git a/spec/frontend/vue_merge_request_widget/extentions/accessibility/index_spec.js b/spec/frontend/vue_merge_request_widget/extentions/accessibility/index_spec.js index 01049e54a7f..9b1e694d9c4 100644 --- a/spec/frontend/vue_merge_request_widget/extentions/accessibility/index_spec.js +++ b/spec/frontend/vue_merge_request_widget/extentions/accessibility/index_spec.js @@ -39,7 +39,6 @@ describe('Accessibility extension', () => { }); afterEach(() => { - wrapper.destroy(); mock.restore(); }); @@ -102,7 +101,7 @@ describe('Accessibility extension', () => { await waitForPromises(); }); - it('displays all report list items in viewport', async () => { + it('displays all report list items in viewport', () => { expect(findAllExtensionListItems()).toHaveLength(7); }); 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 67b327217ef..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 @@ -61,7 +61,6 @@ describe('Code Quality extension', () => { }); afterEach(() => { - wrapper.destroy(); mock.restore(); }); @@ -185,14 +184,14 @@ describe('Code Quality extension', () => { await waitForPromises(); }); - it('displays all report list items in viewport', async () => { - expect(findAllExtensionListItems()).toHaveLength(2); + it('displays all report list items in viewport', () => { + 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( @@ -203,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: { diff --git a/spec/frontend/vue_merge_request_widget/extentions/terraform/index_spec.js b/spec/frontend/vue_merge_request_widget/extentions/terraform/index_spec.js index 13384e1efca..5baed8ff211 100644 --- a/spec/frontend/vue_merge_request_widget/extentions/terraform/index_spec.js +++ b/spec/frontend/vue_merge_request_widget/extentions/terraform/index_spec.js @@ -48,7 +48,6 @@ describe('Terraform extension', () => { }); afterEach(() => { - wrapper.destroy(); mock.restore(); }); @@ -83,7 +82,7 @@ describe('Terraform extension', () => { ${'2 valid reports'} | ${{ 0: validPlanWithName, 1: validPlanWithName }} | ${'2 Terraform reports were generated in your pipelines'} | ${''} ${'1 valid and 2 invalid reports'} | ${{ 0: validPlanWithName, 1: invalidPlanWithName, 2: invalidPlanWithName }} | ${'Terraform report was generated in your pipelines'} | ${'2 Terraform reports failed to generate'} `('and received $responseType', ({ response, summaryTitle, summarySubtitle }) => { - beforeEach(async () => { + beforeEach(() => { mockPollingApi(HTTP_STATUS_OK, response, {}); return createComponent(); }); |