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

bitbucket_server_status_table_spec.js « components « bitbucket_server « import « pages « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 695d1b686a5f2cfb65aac6aefd85fd3f91cac9e4 (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
45
46
47
import { shallowMount } from '@vue/test-utils';

import { GlButton } from '@gitlab/ui';
import BitbucketServerStatusTable from '~/pages/import/bitbucket_server/status/components/bitbucket_server_status_table.vue';
import BitbucketStatusTable from '~/import_entities/import_projects/components/bitbucket_status_table.vue';

const BitbucketStatusTableStub = {
  name: 'BitbucketStatusTable',
  template: '<div><slot name="actions"></slot></div>',
};

describe('BitbucketServerStatusTable', () => {
  let wrapper;

  const findReconfigureButton = () =>
    wrapper
      .findAll(GlButton)
      .filter(w => w.props().variant === 'info')
      .at(0);

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

  function createComponent(bitbucketStatusTableStub = true) {
    wrapper = shallowMount(BitbucketServerStatusTable, {
      propsData: { providerTitle: 'Test', reconfigurePath: '/reconfigure' },
      stubs: {
        BitbucketStatusTable: bitbucketStatusTableStub,
      },
    });
  }

  it('renders bitbucket status table component', () => {
    createComponent();
    expect(wrapper.find(BitbucketStatusTable).exists()).toBe(true);
  });

  it('renders Reconfigure button', async () => {
    createComponent(BitbucketStatusTableStub);
    expect(findReconfigureButton().attributes().href).toBe('/reconfigure');
    expect(findReconfigureButton().text()).toBe('Reconfigure');
  });
});