diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-12 18:10:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-12 18:10:37 +0300 |
commit | 84dd3070dff9e36897345bbfd8dc1bf3470376ae (patch) | |
tree | 022fb1c625685b0dfbbdb0c4cf576df272d52043 /spec/frontend | |
parent | bbfd13e575237aaa69a49caf1e23ebd878c2f824 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/blob_edit/edit_blob_spec.js | 8 | ||||
-rw-r--r-- | spec/frontend/editor/editor_ci_schema_ext_spec.js | 2 | ||||
-rw-r--r-- | spec/frontend/editor/editor_lite_extension_base_spec.js | 2 | ||||
-rw-r--r-- | spec/frontend/editor/editor_lite_spec.js | 2 | ||||
-rw-r--r-- | spec/frontend/editor/editor_markdown_ext_spec.js | 2 | ||||
-rw-r--r-- | spec/frontend/projects/pipelines/charts/components/__snapshots__/ci_cd_analytics_area_chart_spec.js.snap (renamed from spec/frontend/projects/pipelines/charts/components/__snapshots__/pipelines_area_chart_spec.js.snap) | 2 | ||||
-rw-r--r-- | spec/frontend/projects/pipelines/charts/components/app_legacy_spec.js | 13 | ||||
-rw-r--r-- | spec/frontend/projects/pipelines/charts/components/app_spec.js | 63 | ||||
-rw-r--r-- | spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_area_chart_spec.js (renamed from spec/frontend/projects/pipelines/charts/components/pipelines_area_chart_spec.js) | 15 |
9 files changed, 79 insertions, 30 deletions
diff --git a/spec/frontend/blob_edit/edit_blob_spec.js b/spec/frontend/blob_edit/edit_blob_spec.js index f1f22010a2a..7927c14d2ac 100644 --- a/spec/frontend/blob_edit/edit_blob_spec.js +++ b/spec/frontend/blob_edit/edit_blob_spec.js @@ -1,12 +1,12 @@ import waitForPromises from 'helpers/wait_for_promises'; import EditBlob from '~/blob_edit/edit_blob'; import EditorLite from '~/editor/editor_lite'; -import { EditorMarkdownExtension } from '~/editor/editor_markdown_ext'; -import { FileTemplateExtension } from '~/editor/editor_file_template_ext'; +import { EditorMarkdownExtension } from '~/editor/extensions/editor_markdown_ext'; +import { FileTemplateExtension } from '~/editor/extensions/editor_file_template_ext'; jest.mock('~/editor/editor_lite'); -jest.mock('~/editor/editor_markdown_ext'); -jest.mock('~/editor/editor_file_template_ext'); +jest.mock('~/editor/extensions/editor_markdown_ext'); +jest.mock('~/editor/extensions/editor_file_template_ext'); describe('Blob Editing', () => { const useMock = jest.fn(); diff --git a/spec/frontend/editor/editor_ci_schema_ext_spec.js b/spec/frontend/editor/editor_ci_schema_ext_spec.js index f9a1070f601..4d65b77cdfc 100644 --- a/spec/frontend/editor/editor_ci_schema_ext_spec.js +++ b/spec/frontend/editor/editor_ci_schema_ext_spec.js @@ -1,6 +1,6 @@ import { languages } from 'monaco-editor'; import EditorLite from '~/editor/editor_lite'; -import { CiSchemaExtension } from '~/editor/editor_ci_schema_ext'; +import { CiSchemaExtension } from '~/editor/extensions/editor_ci_schema_ext'; import { EXTENSION_CI_SCHEMA_FILE_NAME_MATCH } from '~/editor/constants'; describe('~/editor/editor_ci_config_ext', () => { diff --git a/spec/frontend/editor/editor_lite_extension_base_spec.js b/spec/frontend/editor/editor_lite_extension_base_spec.js index 8261864b7a2..5490e9dc7b5 100644 --- a/spec/frontend/editor/editor_lite_extension_base_spec.js +++ b/spec/frontend/editor/editor_lite_extension_base_spec.js @@ -1,5 +1,5 @@ import { ERROR_INSTANCE_REQUIRED_FOR_EXTENSION } from '~/editor/constants'; -import { EditorLiteExtension } from '~/editor/editor_lite_extension_base'; +import { EditorLiteExtension } from '~/editor/extensions/editor_lite_extension_base'; describe('The basis for an Editor Lite extension', () => { let ext; diff --git a/spec/frontend/editor/editor_lite_spec.js b/spec/frontend/editor/editor_lite_spec.js index 7d8acd8599a..c3099997287 100644 --- a/spec/frontend/editor/editor_lite_spec.js +++ b/spec/frontend/editor/editor_lite_spec.js @@ -2,7 +2,7 @@ import { editor as monacoEditor, languages as monacoLanguages, Uri } from 'monaco-editor'; import waitForPromises from 'helpers/wait_for_promises'; import Editor from '~/editor/editor_lite'; -import { EditorLiteExtension } from '~/editor/editor_lite_extension_base'; +import { EditorLiteExtension } from '~/editor/extensions/editor_lite_extension_base'; import { DEFAULT_THEME, themes } from '~/ide/lib/themes'; import { EDITOR_LITE_INSTANCE_ERROR_NO_EL, URI_PREFIX } from '~/editor/constants'; diff --git a/spec/frontend/editor/editor_markdown_ext_spec.js b/spec/frontend/editor/editor_markdown_ext_spec.js index f3b5add0b70..3f64dcfd7a0 100644 --- a/spec/frontend/editor/editor_markdown_ext_spec.js +++ b/spec/frontend/editor/editor_markdown_ext_spec.js @@ -1,6 +1,6 @@ import { Range, Position } from 'monaco-editor'; import EditorLite from '~/editor/editor_lite'; -import { EditorMarkdownExtension } from '~/editor/editor_markdown_ext'; +import { EditorMarkdownExtension } from '~/editor/extensions/editor_markdown_ext'; describe('Markdown Extension for Editor Lite', () => { let editor; diff --git a/spec/frontend/projects/pipelines/charts/components/__snapshots__/pipelines_area_chart_spec.js.snap b/spec/frontend/projects/pipelines/charts/components/__snapshots__/ci_cd_analytics_area_chart_spec.js.snap index d68e009f46e..fc51825f15b 100644 --- a/spec/frontend/projects/pipelines/charts/components/__snapshots__/pipelines_area_chart_spec.js.snap +++ b/spec/frontend/projects/pipelines/charts/components/__snapshots__/ci_cd_analytics_area_chart_spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PipelinesAreaChart matches the snapshot 1`] = ` +exports[`CiCdAnalyticsAreaChart matches the snapshot 1`] = ` <div class="gl-mt-3" > diff --git a/spec/frontend/projects/pipelines/charts/components/app_legacy_spec.js b/spec/frontend/projects/pipelines/charts/components/app_legacy_spec.js index c03b571eb26..99d0e910485 100644 --- a/spec/frontend/projects/pipelines/charts/components/app_legacy_spec.js +++ b/spec/frontend/projects/pipelines/charts/components/app_legacy_spec.js @@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils'; import { GlColumnChart } from '@gitlab/ui/dist/charts'; import Component from '~/projects/pipelines/charts/components/app_legacy.vue'; import StatisticsList from '~/projects/pipelines/charts/components/statistics_list.vue'; -import PipelinesAreaChart from '~/projects/pipelines/charts/components/pipelines_area_chart.vue'; +import CiCdAnalyticsAreaChart from '~/projects/pipelines/charts/components/ci_cd_analytics_area_chart.vue'; import { counts, timesChartData, @@ -23,6 +23,13 @@ describe('ProjectsPipelinesChartsApp', () => { lastMonthChartData, lastYearChartData, }, + provide: { + projectPath: 'test/project', + shouldRenderDeploymentFrequencyCharts: true, + }, + stubs: { + DeploymentFrequencyCharts: true, + }, }); }); @@ -52,12 +59,12 @@ describe('ProjectsPipelinesChartsApp', () => { describe('pipelines charts', () => { it('displays 3 area charts', () => { - expect(wrapper.findAll(PipelinesAreaChart).length).toBe(3); + expect(wrapper.findAll(CiCdAnalyticsAreaChart).length).toBe(3); }); describe('displays individual correctly', () => { it('renders with the correct data', () => { - const charts = wrapper.findAll(PipelinesAreaChart); + const charts = wrapper.findAll(CiCdAnalyticsAreaChart); for (let i = 0; i < charts.length; i += 1) { const chart = charts.at(i); diff --git a/spec/frontend/projects/pipelines/charts/components/app_spec.js b/spec/frontend/projects/pipelines/charts/components/app_spec.js index 977d1caa2b6..1313a549f02 100644 --- a/spec/frontend/projects/pipelines/charts/components/app_spec.js +++ b/spec/frontend/projects/pipelines/charts/components/app_spec.js @@ -1,10 +1,11 @@ +import { merge } from 'lodash'; import { createLocalVue, shallowMount } from '@vue/test-utils'; import VueApollo from 'vue-apollo'; import createMockApollo from 'jest/helpers/mock_apollo_helper'; import { GlColumnChart } from '@gitlab/ui/dist/charts'; import Component from '~/projects/pipelines/charts/components/app.vue'; import StatisticsList from '~/projects/pipelines/charts/components/statistics_list.vue'; -import PipelinesAreaChart from '~/projects/pipelines/charts/components/pipelines_area_chart.vue'; +import CiCdAnalyticsAreaChart from '~/projects/pipelines/charts/components/ci_cd_analytics_area_chart.vue'; import getPipelineCountByStatus from '~/projects/pipelines/charts/graphql/queries/get_pipeline_count_by_status.query.graphql'; import getProjectPipelineStatistics from '~/projects/pipelines/charts/graphql/queries/get_project_pipeline_statistics.query.graphql'; import { mockPipelineCount, mockPipelineStatistics } from '../mock_data'; @@ -13,6 +14,8 @@ const projectPath = 'gitlab-org/gitlab'; const localVue = createLocalVue(); localVue.use(VueApollo); +const DeploymentFrequencyChartsStub = { name: 'DeploymentFrequencyCharts', render: () => {} }; + describe('ProjectsPipelinesChartsApp', () => { let wrapper; @@ -25,21 +28,29 @@ describe('ProjectsPipelinesChartsApp', () => { return createMockApollo(requestHandlers); } - function createComponent(options = {}) { - const { fakeApollo } = options; - - return shallowMount(Component, { - provide: { - projectPath, - }, - localVue, - apolloProvider: fakeApollo, - }); + function createComponent(mountOptions = {}) { + wrapper = shallowMount( + Component, + merge( + {}, + { + provide: { + projectPath, + shouldRenderDeploymentFrequencyCharts: false, + }, + localVue, + apolloProvider: createMockApolloProvider(), + stubs: { + DeploymentFrequencyCharts: DeploymentFrequencyChartsStub, + }, + }, + mountOptions, + ), + ); } beforeEach(() => { - const fakeApollo = createMockApolloProvider(); - wrapper = createComponent({ fakeApollo }); + createComponent(); }); afterEach(() => { @@ -73,12 +84,12 @@ describe('ProjectsPipelinesChartsApp', () => { describe('pipelines charts', () => { it('displays 3 area charts', () => { - expect(wrapper.findAll(PipelinesAreaChart)).toHaveLength(3); + expect(wrapper.findAll(CiCdAnalyticsAreaChart)).toHaveLength(3); }); describe('displays individual correctly', () => { it('renders with the correct data', () => { - const charts = wrapper.findAll(PipelinesAreaChart); + const charts = wrapper.findAll(CiCdAnalyticsAreaChart); for (let i = 0; i < charts.length; i += 1) { const chart = charts.at(i); @@ -92,4 +103,26 @@ describe('ProjectsPipelinesChartsApp', () => { }); }); }); + + const findDeploymentFrequencyCharts = () => wrapper.find(DeploymentFrequencyChartsStub); + + describe('when shouldRenderDeploymentFrequencyCharts is true', () => { + beforeEach(() => { + createComponent({ provide: { shouldRenderDeploymentFrequencyCharts: true } }); + }); + + it('renders the deployment frequency charts', () => { + expect(findDeploymentFrequencyCharts().exists()).toBe(true); + }); + }); + + describe('when shouldRenderDeploymentFrequencyCharts is false', () => { + beforeEach(() => { + createComponent({ provide: { shouldRenderDeploymentFrequencyCharts: false } }); + }); + + it('does not render the deployment frequency charts', () => { + expect(findDeploymentFrequencyCharts().exists()).toBe(false); + }); + }); }); diff --git a/spec/frontend/projects/pipelines/charts/components/pipelines_area_chart_spec.js b/spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_area_chart_spec.js index aea25903023..64f80300237 100644 --- a/spec/frontend/projects/pipelines/charts/components/pipelines_area_chart_spec.js +++ b/spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_area_chart_spec.js @@ -1,14 +1,23 @@ import { mount } from '@vue/test-utils'; -import Component from '~/projects/pipelines/charts/components/pipelines_area_chart.vue'; +import CiCdAnalyticsAreaChart from '~/projects/pipelines/charts/components/ci_cd_analytics_area_chart.vue'; import { transformedAreaChartData } from '../mock_data'; -describe('PipelinesAreaChart', () => { +describe('CiCdAnalyticsAreaChart', () => { let wrapper; beforeEach(() => { - wrapper = mount(Component, { + wrapper = mount(CiCdAnalyticsAreaChart, { propsData: { chartData: transformedAreaChartData, + areaChartOptions: { + xAxis: { + name: 'X axis title', + type: 'category', + }, + yAxis: { + name: 'Y axis title', + }, + }, }, slots: { default: 'Some title', |