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

new_cluster_spec.js « components « clusters « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b62e678154c422e9fd8db694a3618f157aa36370 (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
import { GlLink, GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue';
import NewCluster from '~/clusters/components/new_cluster.vue';
import createClusterStore from '~/clusters/stores/new_cluster';

describe('NewCluster', () => {
  let store;
  let wrapper;

  const createWrapper = async () => {
    store = createClusterStore({ clusterConnectHelpPath: '/some/help/path' });
    wrapper = shallowMount(NewCluster, { store, stubs: { GlLink, GlSprintf } });
    await nextTick();
  };

  const findDescription = () => wrapper.find(GlSprintf);

  const findLink = () => wrapper.find(GlLink);

  beforeEach(() => {
    return createWrapper();
  });

  afterEach(() => {
    wrapper.destroy();
  });

  it('renders the cluster component correctly', () => {
    expect(wrapper.html()).toMatchSnapshot();
  });

  it('renders the correct information text', () => {
    expect(findDescription().text()).toContain('Enter details about your cluster.');
  });

  it('renders a valid help link set by the backend', () => {
    expect(findLink().attributes('href')).toBe('/some/help/path');
  });
});