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')
-rw-r--r--spec/javascripts/diffs/components/app_spec.js8
-rw-r--r--spec/javascripts/diffs/store/actions_spec.js10
-rw-r--r--spec/javascripts/monitoring/charts/column_spec.js62
-rw-r--r--spec/javascripts/monitoring/charts/empty_chart_spec.js33
-rw-r--r--spec/javascripts/monitoring/charts/heatmap_spec.js69
-rw-r--r--spec/javascripts/monitoring/charts/single_stat_spec.js31
-rw-r--r--spec/javascripts/vue_shared/components/diff_viewer/diff_viewer_spec.js4
7 files changed, 12 insertions, 205 deletions
diff --git a/spec/javascripts/diffs/components/app_spec.js b/spec/javascripts/diffs/components/app_spec.js
index b21cab58b4e..48e1ed18a2f 100644
--- a/spec/javascripts/diffs/components/app_spec.js
+++ b/spec/javascripts/diffs/components/app_spec.js
@@ -92,16 +92,16 @@ describe('diffs/components/app', () => {
});
});
- it('calls fetchDiffFiles if diffsBatchLoad is enabled, and not latest version', () => {
+ it('calls batch methods if diffsBatchLoad is enabled, and not latest version', () => {
wrapper.vm.glFeatures.diffsBatchLoad = true;
wrapper.vm.isLatestVersion = () => false;
wrapper.vm.fetchData(false);
- expect(wrapper.vm.fetchDiffFiles).toHaveBeenCalled();
+ expect(wrapper.vm.fetchDiffFiles).not.toHaveBeenCalled();
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.startRenderDiffsQueue).toHaveBeenCalled();
- expect(wrapper.vm.fetchDiffFilesMeta).not.toHaveBeenCalled();
- expect(wrapper.vm.fetchDiffFilesBatch).not.toHaveBeenCalled();
+ expect(wrapper.vm.fetchDiffFilesMeta).toHaveBeenCalled();
+ expect(wrapper.vm.fetchDiffFilesBatch).toHaveBeenCalled();
});
});
diff --git a/spec/javascripts/diffs/store/actions_spec.js b/spec/javascripts/diffs/store/actions_spec.js
index 589bd0e649a..b23334d38dc 100644
--- a/spec/javascripts/diffs/store/actions_spec.js
+++ b/spec/javascripts/diffs/store/actions_spec.js
@@ -147,13 +147,15 @@ describe('DiffsStoreActions', () => {
describe('fetchDiffFilesBatch', () => {
it('should fetch batch diff files', done => {
const endpointBatch = '/fetch/diffs_batch';
- const batch1 = `${endpointBatch}?per_page=${DIFFS_PER_PAGE}`;
- const batch2 = `${endpointBatch}?per_page=${DIFFS_PER_PAGE}&page=2`;
const mock = new MockAdapter(axios);
const res1 = { diff_files: [], pagination: { next_page: 2 } };
const res2 = { diff_files: [], pagination: {} };
- mock.onGet(batch1).reply(200, res1);
- mock.onGet(batch2).reply(200, res2);
+ mock
+ .onGet(endpointBatch, { params: { page: undefined, per_page: DIFFS_PER_PAGE, w: '1' } })
+ .reply(200, res1);
+ mock
+ .onGet(endpointBatch, { params: { page: 2, per_page: DIFFS_PER_PAGE, w: '1' } })
+ .reply(200, res2);
testAction(
fetchDiffFilesBatch,
diff --git a/spec/javascripts/monitoring/charts/column_spec.js b/spec/javascripts/monitoring/charts/column_spec.js
deleted file mode 100644
index 9676617e8e1..00000000000
--- a/spec/javascripts/monitoring/charts/column_spec.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import { shallowMount, createLocalVue } from '@vue/test-utils';
-import { GlColumnChart } from '@gitlab/ui/dist/charts';
-import ColumnChart from '~/monitoring/components/charts/column.vue';
-
-const localVue = createLocalVue();
-
-describe('Column component', () => {
- let columnChart;
-
- beforeEach(() => {
- columnChart = shallowMount(localVue.extend(ColumnChart), {
- propsData: {
- graphData: {
- metrics: [
- {
- x_label: 'Time',
- y_label: 'Usage',
- result: [
- {
- metric: {},
- values: [
- [1495700554.925, '8.0390625'],
- [1495700614.925, '8.0390625'],
- [1495700674.925, '8.0390625'],
- ],
- },
- ],
- },
- ],
- },
- containerWidth: 100,
- },
- sync: false,
- localVue,
- });
- });
-
- 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);
- });
- });
- });
-});
diff --git a/spec/javascripts/monitoring/charts/empty_chart_spec.js b/spec/javascripts/monitoring/charts/empty_chart_spec.js
deleted file mode 100644
index 06822126b59..00000000000
--- a/spec/javascripts/monitoring/charts/empty_chart_spec.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { shallowMount, createLocalVue } from '@vue/test-utils';
-import EmptyChart from '~/monitoring/components/charts/empty_chart.vue';
-
-const localVue = createLocalVue();
-
-describe('Empty Chart component', () => {
- let emptyChart;
- const graphTitle = 'Memory Usage';
-
- beforeEach(() => {
- emptyChart = shallowMount(localVue.extend(EmptyChart), {
- propsData: {
- graphTitle,
- },
- sync: false,
- localVue,
- });
- });
-
- afterEach(() => {
- emptyChart.destroy();
- });
-
- it('render the chart title', () => {
- expect(emptyChart.find({ ref: 'graphTitle' }).text()).toBe(graphTitle);
- });
-
- describe('Computed props', () => {
- it('sets the height for the svg container', () => {
- expect(emptyChart.vm.svgContainerStyle.height).toBe('300px');
- });
- });
-});
diff --git a/spec/javascripts/monitoring/charts/heatmap_spec.js b/spec/javascripts/monitoring/charts/heatmap_spec.js
deleted file mode 100644
index 9a98fc6fb05..00000000000
--- a/spec/javascripts/monitoring/charts/heatmap_spec.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import { shallowMount } from '@vue/test-utils';
-import { GlHeatmap } from '@gitlab/ui/dist/charts';
-import Heatmap from '~/monitoring/components/charts/heatmap.vue';
-import { graphDataPrometheusQueryRangeMultiTrack } from '../mock_data';
-
-describe('Heatmap component', () => {
- let heatmapChart;
- let store;
-
- beforeEach(() => {
- heatmapChart = shallowMount(Heatmap, {
- propsData: {
- graphData: graphDataPrometheusQueryRangeMultiTrack,
- containerWidth: 100,
- },
- store,
- });
- });
-
- afterEach(() => {
- heatmapChart.destroy();
- });
-
- describe('wrapped components', () => {
- describe('GitLab UI heatmap chart', () => {
- let glHeatmapChart;
-
- beforeEach(() => {
- glHeatmapChart = heatmapChart.find(GlHeatmap);
- });
-
- it('is a Vue instance', () => {
- expect(glHeatmapChart.isVueInstance()).toBe(true);
- });
-
- it('should display a label on the x axis', () => {
- expect(heatmapChart.vm.xAxisName).toBe(graphDataPrometheusQueryRangeMultiTrack.x_label);
- });
-
- it('should display a label on the y axis', () => {
- expect(heatmapChart.vm.yAxisName).toBe(graphDataPrometheusQueryRangeMultiTrack.y_label);
- });
-
- // According to the echarts docs https://echarts.apache.org/en/option.html#series-heatmap.data
- // each row of the heatmap chart is represented by an array inside another parent array
- // e.g. [[0, 0, 10]], the format represents the column, the row and finally the value
- // corresponding to the cell
-
- it('should return chartData with a length of x by y, with a length of 3 per array', () => {
- const row = heatmapChart.vm.chartData[0];
-
- expect(row.length).toBe(3);
- expect(heatmapChart.vm.chartData.length).toBe(30);
- });
-
- it('returns a series of labels for the x axis', () => {
- const { xAxisLabels } = heatmapChart.vm;
-
- expect(xAxisLabels.length).toBe(5);
- });
-
- it('returns a series of labels for the y axis', () => {
- const { yAxisLabels } = heatmapChart.vm;
-
- expect(yAxisLabels.length).toBe(6);
- });
- });
- });
-});
diff --git a/spec/javascripts/monitoring/charts/single_stat_spec.js b/spec/javascripts/monitoring/charts/single_stat_spec.js
deleted file mode 100644
index 6adca0b0eed..00000000000
--- a/spec/javascripts/monitoring/charts/single_stat_spec.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { shallowMount, createLocalVue } from '@vue/test-utils';
-import SingleStatChart from '~/monitoring/components/charts/single_stat.vue';
-import { graphDataPrometheusQuery } from '../mock_data';
-
-const localVue = createLocalVue();
-
-describe('Single Stat Chart component', () => {
- let singleStatChart;
-
- beforeEach(() => {
- singleStatChart = shallowMount(localVue.extend(SingleStatChart), {
- propsData: {
- graphData: graphDataPrometheusQuery,
- },
- sync: false,
- localVue,
- });
- });
-
- afterEach(() => {
- singleStatChart.destroy();
- });
-
- describe('computed', () => {
- describe('engineeringNotation', () => {
- it('should interpolate the value and unit props', () => {
- expect(singleStatChart.vm.engineeringNotation).toBe('91MB');
- });
- });
- });
-});
diff --git a/spec/javascripts/vue_shared/components/diff_viewer/diff_viewer_spec.js b/spec/javascripts/vue_shared/components/diff_viewer/diff_viewer_spec.js
index c743f1f6ad7..6a83790093a 100644
--- a/spec/javascripts/vue_shared/components/diff_viewer/diff_viewer_spec.js
+++ b/spec/javascripts/vue_shared/components/diff_viewer/diff_viewer_spec.js
@@ -38,11 +38,11 @@ describe('DiffViewer', () => {
setTimeout(() => {
expect(vm.$el.querySelector('.deleted img').getAttribute('src')).toBe(
- `//raw/DEF/${RED_BOX_IMAGE_URL}`,
+ `//-/raw/DEF/${RED_BOX_IMAGE_URL}`,
);
expect(vm.$el.querySelector('.added img').getAttribute('src')).toBe(
- `//raw/ABC/${GREEN_BOX_IMAGE_URL}`,
+ `//-/raw/ABC/${GREEN_BOX_IMAGE_URL}`,
);
done();