From 71ae61f8794ed2cde39c52001b5c7e9c1cb4e593 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Sun, 5 Apr 2020 00:09:22 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../components/charts/annotations_spec.js | 27 ++++++++++++++++++++++ .../components/charts/time_series_spec.js | 24 ++++++++++++------- 2 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 spec/frontend/monitoring/components/charts/annotations_spec.js (limited to 'spec/frontend/monitoring') 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); }); }); -- cgit v1.2.1