summaryrefslogtreecommitdiff
path: root/spec/frontend/monitoring/components/empty_state_spec.js
blob: e985e5fb443ea2898b748f818b414a7bdc0198a1 (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
37
38
39
40
41
42
43
44
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',
      emptyNoDataSmallSvgPath: '/path/to/no-data-small.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();
  });
});