diff options
author | George Tsiolis <tsiolis.g@gmail.com> | 2018-03-05 19:50:01 +0300 |
---|---|---|
committer | George Tsiolis <tsiolis.g@gmail.com> | 2018-03-08 20:27:47 +0300 |
commit | 910f513ab2b04bf5607213da0a49ce9c5c73bc32 (patch) | |
tree | 1ed536dd75324de733a30e44f1c320d6c5aec53a /spec | |
parent | 67feb7cd42e439e754d64fce646d8d9fb99a0ad8 (diff) |
Move MemoryGraph and MemoryUsage vue components
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js | 18 | ||||
-rw-r--r-- | spec/javascripts/vue_shared/components/memory_graph_spec.js | 26 |
2 files changed, 6 insertions, 38 deletions
diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js index 07ed7f7f532..31710551399 100644 --- a/spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js +++ b/spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js @@ -1,5 +1,5 @@ import Vue from 'vue'; -import memoryUsageComponent from '~/vue_merge_request_widget/components/mr_widget_memory_usage'; +import MemoryUsage from '~/vue_merge_request_widget/components/memory_usage.vue'; import MRWidgetService from '~/vue_merge_request_widget/services/mr_widget_service'; const url = '/root/acets-review-apps/environments/15/deployments/1/metrics'; @@ -34,7 +34,7 @@ const metricsMockData = { }; const createComponent = () => { - const Component = Vue.extend(memoryUsageComponent); + const Component = Vue.extend(MemoryUsage); return new Component({ el: document.createElement('div'), @@ -67,21 +67,9 @@ describe('MemoryUsage', () => { el = vm.$el; }); - describe('props', () => { - it('should have props with defaults', () => { - const { metricsUrl } = memoryUsageComponent.props; - const MetricsUrlTypeClass = metricsUrl.type; - - Vue.nextTick(() => { - expect(new MetricsUrlTypeClass() instanceof String).toBeTruthy(); - expect(metricsUrl.required).toBeTruthy(); - }); - }); - }); - describe('data', () => { it('should have default data', () => { - const data = memoryUsageComponent.data(); + const data = MemoryUsage.data(); expect(Array.isArray(data.memoryMetrics)).toBeTruthy(); expect(data.memoryMetrics.length).toBe(0); diff --git a/spec/javascripts/vue_shared/components/memory_graph_spec.js b/spec/javascripts/vue_shared/components/memory_graph_spec.js index d46a3f2328e..73a69df019e 100644 --- a/spec/javascripts/vue_shared/components/memory_graph_spec.js +++ b/spec/javascripts/vue_shared/components/memory_graph_spec.js @@ -1,12 +1,12 @@ import Vue from 'vue'; -import memoryGraphComponent from '~/vue_shared/components/memory_graph'; +import MemoryGraph from '~/vue_shared/components/memory_graph.vue'; import { mockMetrics, mockMedian, mockMedianIndex } from './mock_data'; const defaultHeight = '25'; const defaultWidth = '100'; const createComponent = () => { - const Component = Vue.extend(memoryGraphComponent); + const Component = Vue.extend(MemoryGraph); return new Component({ el: document.createElement('div'), @@ -32,29 +32,9 @@ describe('MemoryGraph', () => { el = vm.$el; }); - describe('props', () => { - it('should have props with defaults', (done) => { - const { metrics, deploymentTime, width, height } = memoryGraphComponent.props; - - Vue.nextTick(() => { - const typeClassMatcher = (propItem, expectedType) => { - const PropItemTypeClass = propItem.type; - expect(new PropItemTypeClass() instanceof expectedType).toBeTruthy(); - expect(propItem.required).toBeTruthy(); - }; - - typeClassMatcher(metrics, Array); - typeClassMatcher(deploymentTime, Number); - typeClassMatcher(width, String); - typeClassMatcher(height, String); - done(); - }); - }); - }); - describe('data', () => { it('should have default data', () => { - const data = memoryGraphComponent.data(); + const data = MemoryGraph.data(); const dataValidator = (dataItem, expectedType, defaultVal) => { expect(typeof dataItem).toBe(expectedType); expect(dataItem).toBe(defaultVal); |