Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dashboard_template_spec.js « components « monitoring « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4e220d724f41382af419e65a178639d231b1bd3a (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
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';
import DashboardHeader from '~/monitoring/components/dashboard_header.vue';
import { createStore } from '~/monitoring/stores';
import { dashboardProps } from '../fixture_data';
import { setupAllDashboards } from '../store_utils';

jest.mock('~/lib/utils/url_utility');

describe('Dashboard template', () => {
  let wrapper;
  let store;
  let mock;

  beforeEach(() => {
    store = createStore({
      currentEnvironmentName: 'production',
    });
    mock = new MockAdapter(axios);

    setupAllDashboards(store);
  });

  afterEach(() => {
    mock.restore();
  });

  it('matches the default snapshot', () => {
    wrapper = shallowMount(Dashboard, {
      propsData: { ...dashboardProps },
      store,
      stubs: {
        DashboardHeader,
      },
    });

    expect(wrapper.element).toMatchSnapshot();
  });
});