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/integrations/edit/components')
-rw-r--r--spec/frontend/integrations/edit/components/integration_form_spec.js24
-rw-r--r--spec/frontend/integrations/edit/components/jira_issues_fields_spec.js49
2 files changed, 30 insertions, 43 deletions
diff --git a/spec/frontend/integrations/edit/components/integration_form_spec.js b/spec/frontend/integrations/edit/components/integration_form_spec.js
index ca481e009cf..a2bdece821f 100644
--- a/spec/frontend/integrations/edit/components/integration_form_spec.js
+++ b/spec/frontend/integrations/edit/components/integration_form_spec.js
@@ -1,4 +1,4 @@
-import { GlForm } from '@gitlab/ui';
+import { GlBadge, GlForm } from '@gitlab/ui';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import * as Sentry from '@sentry/browser';
@@ -18,11 +18,18 @@ import {
integrationLevels,
I18N_SUCCESSFUL_CONNECTION_MESSAGE,
I18N_DEFAULT_ERROR_MESSAGE,
+ billingPlans,
+ billingPlanNames,
} from '~/integrations/constants';
import { createStore } from '~/integrations/edit/store';
import httpStatus from '~/lib/utils/http_status';
import { refreshCurrentPage } from '~/lib/utils/url_utility';
-import { mockIntegrationProps, mockField, mockSectionConnection } from '../mock_data';
+import {
+ mockIntegrationProps,
+ mockField,
+ mockSectionConnection,
+ mockSectionJiraIssues,
+} from '../mock_data';
jest.mock('@sentry/browser');
jest.mock('~/lib/utils/url_utility');
@@ -72,6 +79,7 @@ describe('IntegrationForm', () => {
const findInstanceOrGroupSaveButton = () => wrapper.findByTestId('save-button-instance-group');
const findTestButton = () => wrapper.findByTestId('test-button');
const findTriggerFields = () => wrapper.findComponent(TriggerFields);
+ const findGlBadge = () => wrapper.findComponent(GlBadge);
const findGlForm = () => wrapper.findComponent(GlForm);
const findRedirectToField = () => wrapper.findByTestId('redirect-to-field');
const findDynamicField = () => wrapper.findComponent(DynamicField);
@@ -327,9 +335,21 @@ describe('IntegrationForm', () => {
expect(connectionSection.find('h4').text()).toBe(mockSectionConnection.title);
expect(connectionSection.find('p').text()).toBe(mockSectionConnection.description);
+ expect(findGlBadge().exists()).toBe(false);
expect(findConnectionSectionComponent().exists()).toBe(true);
});
+ it('renders GlBadge when `plan` is present', () => {
+ createComponent({
+ customStateProps: {
+ sections: [mockSectionConnection, mockSectionJiraIssues],
+ },
+ });
+
+ expect(findGlBadge().exists()).toBe(true);
+ expect(findGlBadge().text()).toMatchInterpolatedText(billingPlanNames[billingPlans.PREMIUM]);
+ });
+
it('passes only fields with section type', () => {
const sectionFields = [
{ name: 'username', type: 'text', section: mockSectionConnection.type },
diff --git a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
index 94e370a485f..b4c5d4f9957 100644
--- a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
+++ b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
@@ -10,7 +10,6 @@ describe('JiraIssuesFields', () => {
let wrapper;
const defaultProps = {
- showJiraIssuesIntegration: true,
showJiraVulnerabilitiesIntegration: true,
upgradePlanPath: 'https://gitlab.com',
};
@@ -42,8 +41,6 @@ describe('JiraIssuesFields', () => {
findEnableCheckbox().find('[type=checkbox]').attributes('disabled');
const findProjectKey = () => wrapper.findComponent(GlFormInput);
const findProjectKeyFormGroup = () => wrapper.findByTestId('project-key-form-group');
- const findPremiumUpgradeCTA = () => wrapper.findByTestId('premium-upgrade-cta');
- const findUltimateUpgradeCTA = () => wrapper.findByTestId('ultimate-upgrade-cta');
const findJiraForVulnerabilities = () => wrapper.findByTestId('jira-for-vulnerabilities');
const setEnableCheckbox = async (isEnabled = true) =>
findEnableCheckbox().vm.$emit('input', isEnabled);
@@ -55,19 +52,16 @@ describe('JiraIssuesFields', () => {
describe('template', () => {
describe.each`
- showJiraIssuesIntegration | showJiraVulnerabilitiesIntegration
- ${false} | ${false}
- ${false} | ${true}
- ${true} | ${false}
- ${true} | ${true}
+ showJiraIssuesIntegration
+ ${false}
+ ${true}
`(
- 'when `showJiraIssuesIntegration` is $jiraIssues and `showJiraVulnerabilitiesIntegration` is $jiraVulnerabilities',
- ({ showJiraIssuesIntegration, showJiraVulnerabilitiesIntegration }) => {
+ 'when showJiraIssuesIntegration = $showJiraIssuesIntegration',
+ ({ showJiraIssuesIntegration }) => {
beforeEach(() => {
createComponent({
props: {
showJiraIssuesIntegration,
- showJiraVulnerabilitiesIntegration,
},
});
});
@@ -77,39 +71,12 @@ describe('JiraIssuesFields', () => {
expect(findEnableCheckbox().exists()).toBe(true);
expect(findEnableCheckboxDisabled()).toBeUndefined();
});
-
- it('does not render the Premium CTA', () => {
- expect(findPremiumUpgradeCTA().exists()).toBe(false);
- });
-
- if (!showJiraVulnerabilitiesIntegration) {
- it.each`
- scenario | enableJiraIssues
- ${'when "Enable Jira issues" is checked, renders Ultimate upgrade CTA'} | ${true}
- ${'when "Enable Jira issues" is unchecked, does not render Ultimate upgrade CTA'} | ${false}
- `('$scenario', async ({ enableJiraIssues }) => {
- if (enableJiraIssues) {
- await setEnableCheckbox();
- }
- expect(findUltimateUpgradeCTA().exists()).toBe(enableJiraIssues);
- });
- }
} else {
- it('does not render enable checkbox', () => {
- expect(findEnableCheckbox().exists()).toBe(false);
- });
-
- it('renders the Premium CTA', () => {
- const premiumUpgradeCTA = findPremiumUpgradeCTA();
-
- expect(premiumUpgradeCTA.exists()).toBe(true);
- expect(premiumUpgradeCTA.props('upgradePlanPath')).toBe(defaultProps.upgradePlanPath);
+ it('renders enable checkbox as disabled', () => {
+ expect(findEnableCheckbox().exists()).toBe(true);
+ expect(findEnableCheckboxDisabled()).toBe('disabled');
});
}
-
- it('does not render the Ultimate CTA', () => {
- expect(findUltimateUpgradeCTA().exists()).toBe(false);
- });
},
);