Commit 75c616fa authored by Miguel Rincon's avatar Miguel Rincon Committed by Paul Slaughter

Migrate monitor chart specs to jest

https://gitlab.com/gitlab-org/gitlab/merge_requests/21714
parent 5cc3b099
...@@ -4,6 +4,10 @@ import ColumnChart from '~/monitoring/components/charts/column.vue'; ...@@ -4,6 +4,10 @@ import ColumnChart from '~/monitoring/components/charts/column.vue';
const localVue = createLocalVue(); const localVue = createLocalVue();
jest.mock('~/lib/utils/icon_utils', () => ({
getSvgIconPathContent: jest.fn().mockResolvedValue('mockSvgPathContent'),
}));
describe('Column component', () => { describe('Column component', () => {
let columnChart; let columnChart;
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlHeatmap } from '@gitlab/ui/dist/charts'; import { GlHeatmap } from '@gitlab/ui/dist/charts';
import Heatmap from '~/monitoring/components/charts/heatmap.vue'; import Heatmap from '~/monitoring/components/charts/heatmap.vue';
import { graphDataPrometheusQueryRangeMultiTrack } from '../mock_data'; import { graphDataPrometheusQueryRangeMultiTrack } from '../../mock_data';
describe('Heatmap component', () => { describe('Heatmap component', () => {
let heatmapChart; let heatmapChart;
......
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import SingleStatChart from '~/monitoring/components/charts/single_stat.vue'; import SingleStatChart from '~/monitoring/components/charts/single_stat.vue';
import { graphDataPrometheusQuery } from '../mock_data'; import { graphDataPrometheusQuery } from '../../mock_data';
const localVue = createLocalVue(); const localVue = createLocalVue();
......
...@@ -12,20 +12,14 @@ import { ...@@ -12,20 +12,14 @@ import {
mockedQueryResultPayload, mockedQueryResultPayload,
mockProjectDir, mockProjectDir,
mockHost, mockHost,
} from '../mock_data'; } from '../../mock_data';
import * as iconUtils from '~/lib/utils/icon_utils'; import * as iconUtils from '~/lib/utils/icon_utils';
const mockSvgPathContent = 'mockSvgPathContent';
const mockWidgets = 'mockWidgets'; const mockWidgets = 'mockWidgets';
const mockSvgPathContent = 'mockSvgPathContent';
jest.mock('~/lib/utils/icon_utils', () => ({ jest.mock('~/lib/utils/icon_utils', () => ({
getSvgIconPathContent: jest.fn().mockImplementation( getSvgIconPathContent: jest.fn().mockImplementation(() => Promise.resolve(mockSvgPathContent)),
() =>
new Promise(resolve => {
resolve(mockSvgPathContent);
}),
),
})); }));
describe('Time series component', () => { describe('Time series component', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment