diff options
Diffstat (limited to 'spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_charts_spec.js')
-rw-r--r-- | spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_charts_spec.js | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_charts_spec.js b/spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_charts_spec.js index 38760a724ff..94cfa53d1cd 100644 --- a/spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_charts_spec.js +++ b/spec/frontend/projects/pipelines/charts/components/ci_cd_analytics_charts_spec.js @@ -82,15 +82,25 @@ describe('~/vue_shared/components/ci_cd_analytics/ci_cd_analytics_charts.vue', ( ]); }); - it('should select a different chart on change', async () => { - findSegmentedControl().vm.$emit('input', 1); + describe('when the date range is updated', () => { + let chart; - const chart = wrapper.findComponent(CiCdAnalyticsAreaChart); + beforeEach(async () => { + chart = wrapper.findComponent(CiCdAnalyticsAreaChart); - await nextTick(); + await findSegmentedControl().vm.$emit('input', 1); + }); + + it('should select a different chart on change', () => { + expect(chart.props('chartData')).toEqual(transformedAreaChartData); + expect(chart.text()).toBe('Date range: test range 2'); + }); - expect(chart.props('chartData')).toEqual(transformedAreaChartData); - expect(chart.text()).toBe('Date range: test range 2'); + it('will emit a `select-chart` event', () => { + expect(wrapper.emitted()).toEqual({ + 'select-chart': [[1]], + }); + }); }); }); |