2020-03-09 13:42:32 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2019-09-30 21:07:59 +05:30
|
|
|
import { GlColumnChart } from '@gitlab/ui/dist/charts';
|
|
|
|
import ColumnChart from '~/monitoring/components/charts/column.vue';
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
jest.mock('~/lib/utils/icon_utils', () => ({
|
|
|
|
getSvgIconPathContent: jest.fn().mockResolvedValue('mockSvgPathContent'),
|
|
|
|
}));
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
describe('Column component', () => {
|
|
|
|
let columnChart;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2020-03-09 13:42:32 +05:30
|
|
|
columnChart = shallowMount(ColumnChart, {
|
2019-09-30 21:07:59 +05:30
|
|
|
propsData: {
|
|
|
|
graphData: {
|
2020-01-01 13:55:28 +05:30
|
|
|
metrics: [
|
2019-09-30 21:07:59 +05:30
|
|
|
{
|
|
|
|
x_label: 'Time',
|
|
|
|
y_label: 'Usage',
|
|
|
|
result: [
|
|
|
|
{
|
|
|
|
metric: {},
|
|
|
|
values: [
|
|
|
|
[1495700554.925, '8.0390625'],
|
|
|
|
[1495700614.925, '8.0390625'],
|
|
|
|
[1495700674.925, '8.0390625'],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
containerWidth: 100,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|