diff options
| author | Mike Greiling <mike@pixelcog.com> | 2019-06-24 16:45:16 +0000 |
|---|---|---|
| committer | Mike Greiling <mike@pixelcog.com> | 2019-06-24 16:45:16 +0000 |
| commit | c64e5848aef996ff48cc3ccdbcab58d446f51f6d (patch) | |
| tree | 4bd250c765d2b998240181eb75b460501584ebcc /spec/javascripts | |
| parent | f53a6d63a4d017912084c4a1f00b4817664e66a5 (diff) | |
| parent | 5665e91ade9e16ec39e3d7e82e31849ef3554ce4 (diff) | |
| download | gitlab-ce-c64e5848aef996ff48cc3ccdbcab58d446f51f6d.tar.gz | |
Merge branch 'jivanvl-add-column-chart-monitoring-dashboard' into 'master'
Add column chart component to the monitoring bundle
See merge request gitlab-org/gitlab-ce!29293
Diffstat (limited to 'spec/javascripts')
| -rw-r--r-- | spec/javascripts/monitoring/charts/column_spec.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/javascripts/monitoring/charts/column_spec.js b/spec/javascripts/monitoring/charts/column_spec.js new file mode 100644 index 00000000000..d8ac68b9484 --- /dev/null +++ b/spec/javascripts/monitoring/charts/column_spec.js @@ -0,0 +1,58 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlColumnChart } from '@gitlab/ui/dist/charts'; +import ColumnChart from '~/monitoring/components/charts/column.vue'; + +describe('Column component', () => { + let columnChart; + + beforeEach(() => { + columnChart = shallowMount(ColumnChart, { + propsData: { + graphData: { + queries: [ + { + x_label: 'Time', + y_label: 'Usage', + result: [ + { + metric: {}, + values: [ + [1495700554.925, '8.0390625'], + [1495700614.925, '8.0390625'], + [1495700674.925, '8.0390625'], + ], + }, + ], + }, + ], + }, + containerWidth: 100, + }, + }); + }); + + afterEach(() => { + columnChart.destroy(); + }); + + describe('wrapped components', () => { + describe('GitLab UI column chart', () => { + let glColumnChart; + + beforeEach(() => { + glColumnChart = columnChart.find(GlColumnChart); + }); + + it('is a Vue instance', () => { + expect(glColumnChart.isVueInstance()).toBe(true); + }); + + it('receives data properties needed for proper chart render', () => { + const props = glColumnChart.props(); + + expect(props.data).toBe(columnChart.vm.chartData); + expect(props.option).toBe(columnChart.vm.chartOptions); + }); + }); + }); +}); |
