summaryrefslogtreecommitdiff
path: root/spec/frontend/monitoring/components/charts/time_series_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/monitoring/components/charts/time_series_spec.js')
-rw-r--r--spec/frontend/monitoring/components/charts/time_series_spec.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/spec/frontend/monitoring/components/charts/time_series_spec.js b/spec/frontend/monitoring/components/charts/time_series_spec.js
index 97386be9e32..6f9a89feb3e 100644
--- a/spec/frontend/monitoring/components/charts/time_series_spec.js
+++ b/spec/frontend/monitoring/components/charts/time_series_spec.js
@@ -12,7 +12,12 @@ import {
import { shallowWrapperContainsSlotText } from 'helpers/vue_test_utils_helper';
import { panelTypes, chartHeight } from '~/monitoring/constants';
import TimeSeries from '~/monitoring/components/charts/time_series.vue';
-import { deploymentData, mockProjectDir, annotationsData } from '../../mock_data';
+import {
+ deploymentData,
+ mockProjectDir,
+ annotationsData,
+ mockFixedTimeRange,
+} from '../../mock_data';
import { timeSeriesGraphData } from '../../graph_data';
@@ -42,6 +47,7 @@ describe('Time series component', () => {
deploymentData,
annotations: annotationsData,
projectPath: `${TEST_HOST}${mockProjectDir}`,
+ timeRange: mockFixedTimeRange,
...props,
},
stubs: {
@@ -382,6 +388,25 @@ describe('Time series component', () => {
});
describe('chartOptions', () => {
+ describe('x-Axis bounds', () => {
+ it('is set to the time range bounds', () => {
+ expect(getChartOptions().xAxis).toMatchObject({
+ min: mockFixedTimeRange.start,
+ max: mockFixedTimeRange.end,
+ });
+ });
+
+ it('is not set if time range is not set or incorrectly set', () => {
+ wrapper.setProps({
+ timeRange: {},
+ });
+ return wrapper.vm.$nextTick(() => {
+ expect(getChartOptions().xAxis).not.toHaveProperty('min');
+ expect(getChartOptions().xAxis).not.toHaveProperty('max');
+ });
+ });
+ });
+
describe('dataZoom', () => {
it('renders with scroll handle icons', () => {
expect(getChartOptions().dataZoom).toHaveLength(1);