debian-mirror-gitlab/spec/frontend/monitoring/components/dashboard_template_spec.js

42 lines
1 KiB
JavaScript
Raw Normal View History

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-07-28 23:09:34 +05:30
import { dashboardProps } from '../fixture_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, {
2020-07-28 23:09:34 +05:30
propsData: { ...dashboardProps },
2020-06-23 00:09:42 +05:30
store,
stubs: {
DashboardHeader,
},
});
2020-03-13 15:44:24 +05:30
expect(wrapper.element).toMatchSnapshot();
});
});