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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/jira_import/components/jira_import_progress_spec.js')
-rw-r--r--spec/frontend/jira_import/components/jira_import_progress_spec.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/spec/frontend/jira_import/components/jira_import_progress_spec.js b/spec/frontend/jira_import/components/jira_import_progress_spec.js
new file mode 100644
index 00000000000..9a6fc3b5925
--- /dev/null
+++ b/spec/frontend/jira_import/components/jira_import_progress_spec.js
@@ -0,0 +1,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');
+ });
+ });
+});