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:
Diffstat (limited to 'spec/javascripts/monitoring/graph_spec.js')
-rw-r--r--spec/javascripts/monitoring/graph_spec.js34
1 files changed, 8 insertions, 26 deletions
diff --git a/spec/javascripts/monitoring/graph_spec.js b/spec/javascripts/monitoring/graph_spec.js
index 6d6fe410113..7d8b0744af1 100644
--- a/spec/javascripts/monitoring/graph_spec.js
+++ b/spec/javascripts/monitoring/graph_spec.js
@@ -1,9 +1,8 @@
import Vue from 'vue';
-import _ from 'underscore';
import Graph from '~/monitoring/components/graph.vue';
import MonitoringMixins from '~/monitoring/mixins/monitoring_mixins';
import eventHub from '~/monitoring/event_hub';
-import { deploymentData, singleRowMetrics } from './mock_data';
+import { deploymentData, convertDatesMultipleSeries, singleRowMetricsMultipleSeries } from './mock_data';
const createComponent = (propsData) => {
const Component = Vue.extend(Graph);
@@ -13,6 +12,8 @@ const createComponent = (propsData) => {
}).$mount();
};
+const convertedMetrics = convertDatesMultipleSeries(singleRowMetricsMultipleSeries);
+
describe('Graph', () => {
beforeEach(() => {
spyOn(MonitoringMixins.methods, 'formatDeployments').and.returnValue({});
@@ -20,7 +21,7 @@ describe('Graph', () => {
it('has a title', () => {
const component = createComponent({
- graphData: singleRowMetrics[0],
+ graphData: convertedMetrics[1],
classType: 'col-md-6',
updateAspectRatio: false,
deploymentData,
@@ -29,29 +30,10 @@ describe('Graph', () => {
expect(component.$el.querySelector('.text-center').innerText.trim()).toBe(component.graphData.title);
});
- it('creates a path for the line and area of the graph', (done) => {
- const component = createComponent({
- graphData: singleRowMetrics[0],
- classType: 'col-md-6',
- updateAspectRatio: false,
- deploymentData,
- });
-
- Vue.nextTick(() => {
- expect(component.area).toBeDefined();
- expect(component.line).toBeDefined();
- expect(typeof component.area).toEqual('string');
- expect(typeof component.line).toEqual('string');
- expect(_.isFunction(component.xScale)).toBe(true);
- expect(_.isFunction(component.yScale)).toBe(true);
- done();
- });
- });
-
describe('Computed props', () => {
it('axisTransform translates an element Y position depending of its height', () => {
const component = createComponent({
- graphData: singleRowMetrics[0],
+ graphData: convertedMetrics[1],
classType: 'col-md-6',
updateAspectRatio: false,
deploymentData,
@@ -64,7 +46,7 @@ describe('Graph', () => {
it('outterViewBox gets a width and height property based on the DOM size of the element', () => {
const component = createComponent({
- graphData: singleRowMetrics[0],
+ graphData: convertedMetrics[1],
classType: 'col-md-6',
updateAspectRatio: false,
deploymentData,
@@ -79,7 +61,7 @@ describe('Graph', () => {
it('sends an event to the eventhub when it has finished resizing', (done) => {
const component = createComponent({
- graphData: singleRowMetrics[0],
+ graphData: convertedMetrics[1],
classType: 'col-md-6',
updateAspectRatio: false,
deploymentData,
@@ -95,7 +77,7 @@ describe('Graph', () => {
it('has a title for the y-axis and the chart legend that comes from the backend', () => {
const component = createComponent({
- graphData: singleRowMetrics[0],
+ graphData: convertedMetrics[1],
classType: 'col-md-6',
updateAspectRatio: false,
deploymentData,