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
|
import { GlEmptyState } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils';
import JiraImportProgress from '~/jira_import/components/jira_import_progress.vue';
describe('JiraImportProgress', () => {
let wrapper;
const getGlEmptyStateAttribute = attribute => wrapper.find(GlEmptyState).attributes(attribute);
const getParagraphText = () => wrapper.find('p').text();
const mountComponent = ({ mountType = 'shallowMount' } = {}) => {
const mountFunction = mountType === 'shallowMount' ? shallowMount : mount;
return mountFunction(JiraImportProgress, {
propsData: {
illustration: 'illustration.svg',
importInitiator: 'Jane Doe',
importProject: 'JIRAPROJECT',
importTime: '2020-04-08T12:17:25+00:00',
issuesPath: 'gitlab-org/gitlab-test/-/issues',
},
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('empty state', () => {
beforeEach(() => {
wrapper = mountComponent();
});
it('contains illustration', () => {
expect(getGlEmptyStateAttribute('svgpath')).toBe('illustration.svg');
});
it('contains a title', () => {
const title = 'Import in progress';
expect(getGlEmptyStateAttribute('title')).toBe(title);
});
it('contains button text', () => {
expect(getGlEmptyStateAttribute('primarybuttontext')).toBe('View issues');
});
it('contains button url', () => {
expect(getGlEmptyStateAttribute('primarybuttonlink')).toBe('gitlab-org/gitlab-test/-/issues');
});
});
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');
});
});
});
|