summaryrefslogtreecommitdiff
path: root/spec/frontend/projects/pipelines/charts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/frontend/projects/pipelines/charts
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
downloadgitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/frontend/projects/pipelines/charts')
-rw-r--r--spec/frontend/projects/pipelines/charts/components/__snapshots__/ci_cd_analytics_area_chart_spec.js.snap6
-rw-r--r--spec/frontend/projects/pipelines/charts/components/app_spec.js57
2 files changed, 39 insertions, 24 deletions
diff --git a/spec/frontend/projects/pipelines/charts/components/__snapshots__/ci_cd_analytics_area_chart_spec.js.snap b/spec/frontend/projects/pipelines/charts/components/__snapshots__/ci_cd_analytics_area_chart_spec.js.snap
index fc51825f15b..c37f6415898 100644
--- a/spec/frontend/projects/pipelines/charts/components/__snapshots__/ci_cd_analytics_area_chart_spec.js.snap
+++ b/spec/frontend/projects/pipelines/charts/components/__snapshots__/ci_cd_analytics_area_chart_spec.js.snap
@@ -21,7 +21,11 @@ exports[`CiCdAnalyticsAreaChart matches the snapshot 1`] = `
option="[object Object]"
thresholds=""
width="0"
- />
+ >
+ <template />
+
+ <template />
+ </glareachart-stub>
</div>
</div>
`;
diff --git a/spec/frontend/projects/pipelines/charts/components/app_spec.js b/spec/frontend/projects/pipelines/charts/components/app_spec.js
index e8aace14db4..0cf05d4ac37 100644
--- a/spec/frontend/projects/pipelines/charts/components/app_spec.js
+++ b/spec/frontend/projects/pipelines/charts/components/app_spec.js
@@ -10,6 +10,7 @@ import PipelineCharts from '~/projects/pipelines/charts/components/pipeline_char
jest.mock('~/lib/utils/url_utility');
const DeploymentFrequencyChartsStub = { name: 'DeploymentFrequencyCharts', render: () => {} };
+const LeadTimeChartsStub = { name: 'LeadTimeCharts', render: () => {} };
describe('ProjectsPipelinesChartsApp', () => {
let wrapper;
@@ -21,10 +22,11 @@ describe('ProjectsPipelinesChartsApp', () => {
{},
{
provide: {
- shouldRenderDeploymentFrequencyCharts: false,
+ shouldRenderDoraCharts: true,
},
stubs: {
DeploymentFrequencyCharts: DeploymentFrequencyChartsStub,
+ LeadTimeCharts: LeadTimeChartsStub,
},
},
mountOptions,
@@ -32,37 +34,42 @@ describe('ProjectsPipelinesChartsApp', () => {
);
}
- beforeEach(() => {
- createComponent();
- });
-
afterEach(() => {
wrapper.destroy();
- wrapper = null;
});
const findGlTabs = () => wrapper.find(GlTabs);
- const findAllGlTab = () => wrapper.findAll(GlTab);
- const findGlTabAt = (i) => findAllGlTab().at(i);
+ const findAllGlTabs = () => wrapper.findAll(GlTab);
+ const findGlTabAtIndex = (index) => findAllGlTabs().at(index);
+ const findLeadTimeCharts = () => wrapper.find(LeadTimeChartsStub);
const findDeploymentFrequencyCharts = () => wrapper.find(DeploymentFrequencyChartsStub);
const findPipelineCharts = () => wrapper.find(PipelineCharts);
- it('renders the pipeline charts', () => {
- expect(findPipelineCharts().exists()).toBe(true);
- });
-
- describe('when shouldRenderDeploymentFrequencyCharts is true', () => {
+ describe('when all charts are available', () => {
beforeEach(() => {
- createComponent({ provide: { shouldRenderDeploymentFrequencyCharts: true } });
+ createComponent();
});
- it('renders the deployment frequency charts in a tab', () => {
+ it('renders tabs', () => {
expect(findGlTabs().exists()).toBe(true);
- expect(findGlTabAt(0).attributes('title')).toBe('Pipelines');
- expect(findGlTabAt(1).attributes('title')).toBe('Deployments');
+
+ expect(findGlTabAtIndex(0).attributes('title')).toBe('Pipelines');
+ expect(findGlTabAtIndex(1).attributes('title')).toBe('Deployments');
+ expect(findGlTabAtIndex(2).attributes('title')).toBe('Lead Time');
+ });
+
+ it('renders the pipeline charts', () => {
+ expect(findPipelineCharts().exists()).toBe(true);
+ });
+
+ it('renders the deployment frequency charts', () => {
expect(findDeploymentFrequencyCharts().exists()).toBe(true);
});
+ it('renders the lead time charts', () => {
+ expect(findLeadTimeCharts().exists()).toBe(true);
+ });
+
it('sets the tab and url when a tab is clicked', async () => {
let chartsPath;
setWindowLocation(`${TEST_HOST}/gitlab-org/gitlab-test/-/pipelines/charts`);
@@ -108,6 +115,7 @@ describe('ProjectsPipelinesChartsApp', () => {
describe('when provided with a query param', () => {
it.each`
chart | tab
+ ${'lead-time'} | ${'2'}
${'deployments'} | ${'1'}
${'pipelines'} | ${'0'}
${'fake'} | ${'0'}
@@ -118,7 +126,7 @@ describe('ProjectsPipelinesChartsApp', () => {
expect(name).toBe('chart');
return chart ? [chart] : [];
});
- createComponent({ provide: { shouldRenderDeploymentFrequencyCharts: true } });
+ createComponent();
expect(findGlTabs().attributes('value')).toBe(tab);
});
@@ -138,7 +146,7 @@ describe('ProjectsPipelinesChartsApp', () => {
return [];
});
- createComponent({ provide: { shouldRenderDeploymentFrequencyCharts: true } });
+ createComponent();
expect(findGlTabs().attributes('value')).toBe('0');
@@ -155,14 +163,17 @@ describe('ProjectsPipelinesChartsApp', () => {
});
});
- describe('when shouldRenderDeploymentFrequencyCharts is false', () => {
+ describe('when the dora charts are not available', () => {
beforeEach(() => {
- createComponent({ provide: { shouldRenderDeploymentFrequencyCharts: false } });
+ createComponent({ provide: { shouldRenderDoraCharts: false } });
});
- it('does not render the deployment frequency charts in a tab', () => {
+ it('does not render tabs', () => {
expect(findGlTabs().exists()).toBe(false);
- expect(findDeploymentFrequencyCharts().exists()).toBe(false);
+ });
+
+ it('renders the pipeline charts', () => {
+ expect(findPipelineCharts().exists()).toBe(true);
});
});
});