From e02cd451b2d6a81f4847f26b29ed1eb6c74f8dab Mon Sep 17 00:00:00 2001 From: Jose Vargas Date: Thu, 30 May 2019 13:47:32 -0500 Subject: [PATCH] Add single_stat chart component to the monitoring bundle This merge requests just adds the component without integrating it to the dashboard, it adds tests as well --- .../components/charts/single_stat.vue | 37 +++++++++++++++++++ .../monitoring/charts/single_stat_spec.js | 28 ++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 app/assets/javascripts/monitoring/components/charts/single_stat.vue create mode 100644 spec/javascripts/monitoring/charts/single_stat_spec.js diff --git a/app/assets/javascripts/monitoring/components/charts/single_stat.vue b/app/assets/javascripts/monitoring/components/charts/single_stat.vue new file mode 100644 index 00000000000..b03a6ca1806 --- /dev/null +++ b/app/assets/javascripts/monitoring/components/charts/single_stat.vue @@ -0,0 +1,37 @@ + + diff --git a/spec/javascripts/monitoring/charts/single_stat_spec.js b/spec/javascripts/monitoring/charts/single_stat_spec.js new file mode 100644 index 00000000000..12b73002f97 --- /dev/null +++ b/spec/javascripts/monitoring/charts/single_stat_spec.js @@ -0,0 +1,28 @@ +import { shallowMount } from '@vue/test-utils'; +import SingleStatChart from '~/monitoring/components/charts/single_stat.vue'; + +describe('Single Stat Chart component', () => { + let singleStatChart; + + beforeEach(() => { + singleStatChart = shallowMount(SingleStatChart, { + propsData: { + title: 'Time to render', + value: 1, + unit: 'sec', + }, + }); + }); + + afterEach(() => { + singleStatChart.destroy(); + }); + + describe('computed', () => { + describe('valueWithUnit', () => { + it('should interpolate the value and unit props', () => { + expect(singleStatChart.vm.valueWithUnit).toBe('1sec'); + }); + }); + }); +});