blob: e3c56ef4cbf54d6fd7ce4c5519d807067aa6c713 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import { shallowMount } from '@vue/test-utils';
import DashboardPage from '~/monitoring/pages/dashboard_page.vue';
import Dashboard from '~/monitoring/components/dashboard.vue';
import { propsData } from '../mock_data';
describe('monitoring/pages/dashboard_page', () => {
let wrapper;
const buildWrapper = (props = {}) => {
wrapper = shallowMount(DashboardPage, {
propsData: {
...props,
},
});
};
const findDashboardComponent = () => wrapper.find(Dashboard);
afterEach(() => {
if (wrapper) {
wrapper.destroy();
wrapper = null;
}
});
it('throws errors if dashboard props are not passed', () => {
expect(() => buildWrapper()).toThrow('Missing required prop: "dashboardProps"');
});
it('renders the dashboard page with dashboard component', () => {
buildWrapper({ dashboardProps: propsData });
expect(findDashboardComponent().props()).toMatchObject(propsData);
expect(findDashboardComponent()).toExist();
});
});
|