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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-12 21:07:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-12 21:07:13 +0300
commitba5be4989e02566ad45191b6d97815e189a26dac (patch)
tree96a4ace3c3d61ec4aea31cbf548718ef67cfd84b /spec/frontend/jira_connect
parent22a3da26ad21d67acaef7b2598429c8a003f1037 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/jira_connect')
-rw-r--r--spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js56
-rw-r--r--spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions_spec.js35
2 files changed, 79 insertions, 12 deletions
diff --git a/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js b/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js
index 10696d25f17..e98c6ff1054 100644
--- a/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js
+++ b/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js
@@ -1,12 +1,14 @@
import { nextTick } from 'vue';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
+import SetupInstructions from '~/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions.vue';
import SignInGitlabMultiversion from '~/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index.vue';
-import VersionSelectForm from '~/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/version_select_form.vue';
import SignInOauthButton from '~/jira_connect/subscriptions/components/sign_in_oauth_button.vue';
+import VersionSelectForm from '~/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/version_select_form.vue';
import { updateInstallation } from '~/jira_connect/subscriptions/api';
import { reloadPage, persistBaseUrl, retrieveBaseUrl } from '~/jira_connect/subscriptions/utils';
+import { GITLAB_COM_BASE_PATH } from '~/jira_connect/subscriptions/constants';
jest.mock('~/jira_connect/subscriptions/api', () => {
return {
@@ -21,8 +23,9 @@ describe('SignInGitlabMultiversion', () => {
const mockBasePath = 'gitlab.mycompany.com';
- const findVersionSelectForm = () => wrapper.findComponent(VersionSelectForm);
+ const findSetupInstructions = () => wrapper.findComponent(SetupInstructions);
const findSignInOauthButton = () => wrapper.findComponent(SignInOauthButton);
+ const findVersionSelectForm = () => wrapper.findComponent(VersionSelectForm);
const findSubtitle = () => wrapper.findByTestId('subtitle');
const createComponent = () => {
@@ -59,15 +62,48 @@ describe('SignInGitlabMultiversion', () => {
});
describe('when version is selected', () => {
- beforeEach(() => {
- retrieveBaseUrl.mockReturnValue(mockBasePath);
- createComponent();
+ describe('when on self-managed', () => {
+ beforeEach(() => {
+ retrieveBaseUrl.mockReturnValue(mockBasePath);
+ createComponent();
+ });
+
+ it('renders correct subtitle', () => {
+ expect(findSubtitle().text()).toBe(SignInGitlabMultiversion.i18n.signInSubtitle);
+ });
+
+ it('renders setup instructions', () => {
+ expect(findSetupInstructions().exists()).toBe(true);
+ });
+
+ describe('when SetupInstructions emits `next` event', () => {
+ beforeEach(async () => {
+ findSetupInstructions().vm.$emit('next');
+ await nextTick();
+ });
+
+ it('renders sign in button', () => {
+ expect(findSignInOauthButton().props('gitlabBasePath')).toBe(mockBasePath);
+ });
+
+ it('hides setup instructions', () => {
+ expect(findSetupInstructions().exists()).toBe(false);
+ });
+ });
});
- describe('sign in button', () => {
+ describe('when on GitLab.com', () => {
+ beforeEach(() => {
+ retrieveBaseUrl.mockReturnValue(GITLAB_COM_BASE_PATH);
+ createComponent();
+ });
+
+ it('does not render setup instructions', () => {
+ expect(findSetupInstructions().exists()).toBe(false);
+ });
+
it('renders sign in button', () => {
- expect(findSignInOauthButton().exists()).toBe(true);
- expect(findSignInOauthButton().props('gitlabBasePath')).toBe(mockBasePath);
+ expect(findSignInOauthButton().props('gitlabBasePath')).toBe(GITLAB_COM_BASE_PATH);
});
describe('when button emits `sign-in` event', () => {
@@ -90,9 +126,5 @@ describe('SignInGitlabMultiversion', () => {
});
});
});
-
- it('renders correct subtitle', () => {
- expect(findSubtitle().text()).toBe(SignInGitlabMultiversion.i18n.signInSubtitle);
- });
});
});
diff --git a/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions_spec.js b/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions_spec.js
new file mode 100644
index 00000000000..5496cf008c5
--- /dev/null
+++ b/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions_spec.js
@@ -0,0 +1,35 @@
+import { shallowMount } from '@vue/test-utils';
+import { GlButton, GlLink } from '@gitlab/ui';
+
+import { OAUTH_SELF_MANAGED_DOC_LINK } from '~/jira_connect/subscriptions/constants';
+import SetupInstructions from '~/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions.vue';
+
+describe('SetupInstructions', () => {
+ let wrapper;
+
+ const findGlButton = () => wrapper.findComponent(GlButton);
+ const findGlLink = () => wrapper.findComponent(GlLink);
+
+ const createComponent = () => {
+ wrapper = shallowMount(SetupInstructions);
+ };
+
+ describe('template', () => {
+ beforeEach(() => {
+ createComponent();
+ });
+
+ it('renders "Learn more" link to documentation', () => {
+ expect(findGlLink().attributes('href')).toBe(OAUTH_SELF_MANAGED_DOC_LINK);
+ });
+
+ describe('when button is clicked', () => {
+ it('emits "next" event', () => {
+ expect(wrapper.emitted('next')).toBeUndefined();
+ findGlButton().vm.$emit('click');
+
+ expect(wrapper.emitted('next')).toHaveLength(1);
+ });
+ });
+ });
+});