Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-13 03:08:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-13 03:08:46 +0300
commit47d1f417f03aca055b2ba49c32bb6fb01c459831 (patch)
tree200f05f28369cbf3a34abcb4a3c388558268b86f /spec/frontend
parent006e89697dd5165f355afc20fc6bb0cdfa7b381a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/monitoring/components/charts/single_stat_spec.js48
1 files changed, 46 insertions, 2 deletions
diff --git a/spec/frontend/monitoring/components/charts/single_stat_spec.js b/spec/frontend/monitoring/components/charts/single_stat_spec.js
index 2410dae112b..1aa7ba867b4 100644
--- a/spec/frontend/monitoring/components/charts/single_stat_spec.js
+++ b/spec/frontend/monitoring/components/charts/single_stat_spec.js
@@ -18,9 +18,53 @@ describe('Single Stat Chart component', () => {
});
describe('computed', () => {
- describe('engineeringNotation', () => {
+ describe('statValue', () => {
it('should interpolate the value and unit props', () => {
- expect(singleStatChart.vm.engineeringNotation).toBe('91MB');
+ expect(singleStatChart.vm.statValue).toBe('91MB');
+ });
+
+ it('should change the value representation to a percentile one', () => {
+ singleStatChart.setProps({
+ graphData: {
+ ...graphDataPrometheusQuery,
+ max_value: 120,
+ },
+ });
+
+ expect(singleStatChart.vm.statValue).toContain('75.8');
+ });
+
+ it('should display NaN for non numeric max_value values', () => {
+ singleStatChart.setProps({
+ graphData: {
+ ...graphDataPrometheusQuery,
+ max_value: 'not a number',
+ },
+ });
+
+ expect(singleStatChart.vm.statValue).toContain('NaN');
+ });
+
+ it('should display NaN for missing query values', () => {
+ singleStatChart.setProps({
+ graphData: {
+ ...graphDataPrometheusQuery,
+ metrics: [
+ {
+ ...graphDataPrometheusQuery.metrics[0],
+ result: [
+ {
+ ...graphDataPrometheusQuery.metrics[0].result[0],
+ value: [''],
+ },
+ ],
+ },
+ ],
+ max_value: 120,
+ },
+ });
+
+ expect(singleStatChart.vm.statValue).toContain('NaN');
});
});
});