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

jira_import_progress_spec.js « components « jira_import « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ed7e1824fa3b1c0473a068898c5f002e2fd3ea6c (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { GlEmptyState } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils';
import JiraImportProgress from '~/jira_import/components/jira_import_progress.vue';
import { illustration, issuesPath } from '../mock_data';

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

  const importProject = 'JIRAPROJECT';

  const getGlEmptyStateProp = attribute => wrapper.find(GlEmptyState).props(attribute);

  const getParagraphText = () => wrapper.find('p').text();

  const mountComponent = ({ mountType = 'shallowMount' } = {}) => {
    const mountFunction = mountType === 'shallowMount' ? shallowMount : mount;
    return mountFunction(JiraImportProgress, {
      propsData: {
        illustration,
        importInitiator: 'Jane Doe',
        importProject,
        importTime: '2020-04-08T12:17:25+00:00',
        issuesPath,
      },
    });
  };

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

  describe('empty state', () => {
    beforeEach(() => {
      wrapper = mountComponent();
    });

    it('contains illustration', () => {
      expect(getGlEmptyStateProp('svgPath')).toBe(illustration);
    });

    it('contains a title', () => {
      const title = 'Import in progress';
      expect(getGlEmptyStateProp('title')).toBe(title);
    });

    it('contains button text', () => {
      expect(getGlEmptyStateProp('primaryButtonText')).toBe('View issues');
    });

    it('contains button url', () => {
      const expected = `${issuesPath}?search=${importProject}`;
      expect(getGlEmptyStateProp('primaryButtonLink')).toBe(expected);
    });
  });

  describe('description', () => {
    beforeEach(() => {
      wrapper = mountComponent({ mountType: 'mount' });
    });

    it('shows who initiated the import', () => {
      expect(getParagraphText()).toContain('Import started by: Jane Doe');
    });

    it('shows the time of import', () => {
      expect(getParagraphText()).toContain('Time of import: Apr 8, 2020 12:17pm GMT+0000');
    });

    it('shows the project key of the import', () => {
      expect(getParagraphText()).toContain('Jira project: JIRAPROJECT');
    });
  });
});