debian-mirror-gitlab/spec/frontend/monitoring/dashboard_state_spec.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-09-30 21:07:59 +05:30
import { shallowMount } from '@vue/test-utils';
import EmptyState from '~/monitoring/components/empty_state.vue';
function createComponent(props) {
return shallowMount(EmptyState, {
propsData: {
...props,
settingsPath: '/settingsPath',
clustersPath: '/clustersPath',
documentationPath: '/documentationPath',
emptyGettingStartedSvgPath: '/path/to/getting-started.svg',
emptyLoadingSvgPath: '/path/to/loading.svg',
emptyNoDataSvgPath: '/path/to/no-data.svg',
emptyUnableToConnectSvgPath: '/path/to/unable-to-connect.svg',
},
});
}
describe('EmptyState', () => {
it('shows gettingStarted state', () => {
const wrapper = createComponent({
selectedState: 'gettingStarted',
});
expect(wrapper.element).toMatchSnapshot();
});
it('shows loading state', () => {
const wrapper = createComponent({
selectedState: 'loading',
});
expect(wrapper.element).toMatchSnapshot();
});
it('shows unableToConnect state', () => {
const wrapper = createComponent({
selectedState: 'unableToConnect',
});
expect(wrapper.element).toMatchSnapshot();
});
});