diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-05 03:09:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-05 03:09:22 +0300 |
commit | 71ae61f8794ed2cde39c52001b5c7e9c1cb4e593 (patch) | |
tree | 2389d6d90386be35fbd3810dea3b117edf8b3e8a /spec/frontend | |
parent | 961ecc4cc2cc02e14ca577da55f1be174934e879 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/monitoring/components/charts/annotations_spec.js | 27 | ||||
-rw-r--r-- | spec/frontend/monitoring/components/charts/time_series_spec.js | 24 |
2 files changed, 43 insertions, 8 deletions
diff --git a/spec/frontend/monitoring/components/charts/annotations_spec.js b/spec/frontend/monitoring/components/charts/annotations_spec.js new file mode 100644 index 00000000000..100b13eabf4 --- /dev/null +++ b/spec/frontend/monitoring/components/charts/annotations_spec.js @@ -0,0 +1,27 @@ +import { generateAnnotationsSeries } from '~/monitoring/components/charts/annotations'; +import { deploymentData } from '../../mock_data'; + +describe('annotations spec', () => { + describe('generateAnnotationsSeries', () => { + it('default options', () => { + const annotations = generateAnnotationsSeries(); + expect(annotations).toEqual([]); + }); + + it('with deployments', () => { + const annotations = generateAnnotationsSeries(deploymentData); + + expect(annotations).toEqual( + expect.objectContaining({ + type: 'scatter', + yAxisIndex: 1, + data: expect.any(Array), + }), + ); + + annotations.data.forEach(annotation => { + expect(annotation).toEqual(expect.any(Object)); + }); + }); + }); +}); diff --git a/spec/frontend/monitoring/components/charts/time_series_spec.js b/spec/frontend/monitoring/components/charts/time_series_spec.js index 129d6eda7cf..84b74ef659e 100644 --- a/spec/frontend/monitoring/components/charts/time_series_spec.js +++ b/spec/frontend/monitoring/components/charts/time_series_spec.js @@ -413,16 +413,24 @@ describe('Time series component', () => { }); }); - describe('deploymentSeries', () => { + describe('annotationSeries', () => { it('utilizes deployment data', () => { - expect(timeSeriesChart.vm.deploymentSeries.yAxisIndex).toBe(1); // same as deployment y axis - expect(timeSeriesChart.vm.deploymentSeries.data).toEqual([ - ['2019-07-16T10:14:25.589Z', expect.any(Number)], - ['2019-07-16T11:14:25.589Z', expect.any(Number)], - ['2019-07-16T12:14:25.589Z', expect.any(Number)], + const annotationSeries = timeSeriesChart.vm.chartOptionSeries[0]; + expect(annotationSeries.yAxisIndex).toBe(1); // same as annotations y axis + expect(annotationSeries.data).toEqual([ + expect.objectContaining({ + symbolSize: 14, + value: ['2019-07-16T10:14:25.589Z', expect.any(Number)], + }), + expect.objectContaining({ + symbolSize: 14, + value: ['2019-07-16T11:14:25.589Z', expect.any(Number)], + }), + expect.objectContaining({ + symbolSize: 14, + value: ['2019-07-16T12:14:25.589Z', expect.any(Number)], + }), ]); - - expect(timeSeriesChart.vm.deploymentSeries.symbolSize).toBe(14); }); }); |