2020-03-13 15:44:24 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
import MockAdapter from 'axios-mock-adapter';
|
|
|
|
import axios from '~/lib/utils/axios_utils';
|
|
|
|
import Dashboard from '~/monitoring/components/dashboard.vue';
|
2020-06-23 00:09:42 +05:30
|
|
|
import DashboardHeader from '~/monitoring/components/dashboard_header.vue';
|
2020-03-13 15:44:24 +05:30
|
|
|
import { createStore } from '~/monitoring/stores';
|
2020-05-24 23:13:21 +05:30
|
|
|
import { setupAllDashboards } from '../store_utils';
|
2020-04-22 19:07:51 +05:30
|
|
|
import { propsData } from '../mock_data';
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
jest.mock('~/lib/utils/url_utility');
|
|
|
|
|
|
|
|
describe('Dashboard template', () => {
|
|
|
|
let wrapper;
|
|
|
|
let store;
|
|
|
|
let mock;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2020-06-23 00:09:42 +05:30
|
|
|
store = createStore({
|
|
|
|
currentEnvironmentName: 'production',
|
|
|
|
});
|
2020-03-13 15:44:24 +05:30
|
|
|
mock = new MockAdapter(axios);
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
setupAllDashboards(store);
|
2020-03-13 15:44:24 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
mock.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('matches the default snapshot', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
wrapper = shallowMount(Dashboard, {
|
|
|
|
propsData: { ...propsData },
|
|
|
|
store,
|
|
|
|
stubs: {
|
|
|
|
DashboardHeader,
|
|
|
|
},
|
|
|
|
});
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
expect(wrapper.element).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|