diff options
Diffstat (limited to 'spec/frontend/integrations/edit/components')
-rw-r--r-- | spec/frontend/integrations/edit/components/integration_form_spec.js | 63 | ||||
-rw-r--r-- | spec/frontend/integrations/edit/components/jira_issues_fields_spec.js | 44 |
2 files changed, 7 insertions, 100 deletions
diff --git a/spec/frontend/integrations/edit/components/integration_form_spec.js b/spec/frontend/integrations/edit/components/integration_form_spec.js index c4569070d09..ca481e009cf 100644 --- a/spec/frontend/integrations/edit/components/integration_form_spec.js +++ b/spec/frontend/integrations/edit/components/integration_form_spec.js @@ -9,8 +9,6 @@ import ActiveCheckbox from '~/integrations/edit/components/active_checkbox.vue'; import ConfirmationModal from '~/integrations/edit/components/confirmation_modal.vue'; import DynamicField from '~/integrations/edit/components/dynamic_field.vue'; import IntegrationForm from '~/integrations/edit/components/integration_form.vue'; -import JiraIssuesFields from '~/integrations/edit/components/jira_issues_fields.vue'; -import JiraTriggerFields from '~/integrations/edit/components/jira_trigger_fields.vue'; import OverrideDropdown from '~/integrations/edit/components/override_dropdown.vue'; import ResetConfirmationModal from '~/integrations/edit/components/reset_confirmation_modal.vue'; import TriggerFields from '~/integrations/edit/components/trigger_fields.vue'; @@ -55,7 +53,6 @@ describe('IntegrationForm', () => { OverrideDropdown, ActiveCheckbox, ConfirmationModal, - JiraTriggerFields, TriggerFields, }, mocks: { @@ -74,8 +71,6 @@ describe('IntegrationForm', () => { const findProjectSaveButton = () => wrapper.findByTestId('save-button'); const findInstanceOrGroupSaveButton = () => wrapper.findByTestId('save-button-instance-group'); const findTestButton = () => wrapper.findByTestId('test-button'); - const findJiraTriggerFields = () => wrapper.findComponent(JiraTriggerFields); - const findJiraIssuesFields = () => wrapper.findComponent(JiraIssuesFields); const findTriggerFields = () => wrapper.findComponent(TriggerFields); const findGlForm = () => wrapper.findComponent(GlForm); const findRedirectToField = () => wrapper.findByTestId('redirect-to-field'); @@ -198,49 +193,6 @@ describe('IntegrationForm', () => { }); }); - describe('type is "slack"', () => { - beforeEach(() => { - createComponent({ - customStateProps: { type: 'slack' }, - }); - }); - - it('does not render JiraTriggerFields', () => { - expect(findJiraTriggerFields().exists()).toBe(false); - }); - - it('does not render JiraIssuesFields', () => { - expect(findJiraIssuesFields().exists()).toBe(false); - }); - }); - - describe('type is "jira"', () => { - beforeEach(() => { - jest.spyOn(document, 'querySelector').mockReturnValue(document.createElement('form')); - - createComponent({ - customStateProps: { type: 'jira', testPath: '/test' }, - mountFn: mountExtended, - }); - }); - - it('renders JiraTriggerFields', () => { - expect(findJiraTriggerFields().exists()).toBe(true); - }); - - it('renders JiraIssuesFields', () => { - expect(findJiraIssuesFields().exists()).toBe(true); - }); - - describe('when JiraIssueFields emits `request-jira-issue-types` event', () => { - it('dispatches `requestJiraIssueTypes` action', () => { - findJiraIssuesFields().vm.$emit('request-jira-issue-types'); - - expect(dispatch).toHaveBeenCalledWith('requestJiraIssueTypes', expect.any(FormData)); - }); - }); - }); - describe('triggerEvents is present', () => { it('renders TriggerFields', () => { const events = [{ title: 'push' }]; @@ -272,9 +224,6 @@ describe('IntegrationForm', () => { ]; createComponent({ - provide: { - glFeatures: { integrationFormSections: true }, - }, customStateProps: { sections: [mockSectionConnection], fields: [...sectionFields, ...nonSectionFields], @@ -363,9 +312,6 @@ describe('IntegrationForm', () => { describe('when integration has sections', () => { beforeEach(() => { createComponent({ - provide: { - glFeatures: { integrationFormSections: true }, - }, customStateProps: { sections: [mockSectionConnection], }, @@ -396,9 +342,6 @@ describe('IntegrationForm', () => { ]; createComponent({ - provide: { - glFeatures: { integrationFormSections: true }, - }, customStateProps: { sections: [mockSectionConnection], fields: [...sectionFields, ...nonSectionFields], @@ -417,9 +360,6 @@ describe('IntegrationForm', () => { ({ formActive, novalidate }) => { beforeEach(() => { createComponent({ - provide: { - glFeatures: { integrationFormSections: true }, - }, customStateProps: { sections: [mockSectionConnection], showActive: true, @@ -441,9 +381,6 @@ describe('IntegrationForm', () => { jest.spyOn(document, 'querySelector').mockReturnValue(document.createElement('form')); createComponent({ - provide: { - glFeatures: { integrationFormSections: true }, - }, customStateProps: { sections: [mockSectionConnection], testPath: '/test', 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 33fd08a5959..94e370a485f 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 = { - editProjectPath: '/edit', showJiraIssuesIntegration: true, showJiraVulnerabilitiesIntegration: true, upgradePlanPath: 'https://gitlab.com', @@ -46,7 +45,6 @@ describe('JiraIssuesFields', () => { const findPremiumUpgradeCTA = () => wrapper.findByTestId('premium-upgrade-cta'); const findUltimateUpgradeCTA = () => wrapper.findByTestId('ultimate-upgrade-cta'); const findJiraForVulnerabilities = () => wrapper.findByTestId('jira-for-vulnerabilities'); - const findConflictWarning = () => wrapper.findByTestId('conflict-warning-text'); const setEnableCheckbox = async (isEnabled = true) => findEnableCheckbox().vm.$emit('input', isEnabled); @@ -75,10 +73,9 @@ describe('JiraIssuesFields', () => { }); if (showJiraIssuesIntegration) { - it('renders checkbox and input field', () => { + it('renders enable checkbox', () => { expect(findEnableCheckbox().exists()).toBe(true); expect(findEnableCheckboxDisabled()).toBeUndefined(); - expect(findProjectKey().exists()).toBe(true); }); it('does not render the Premium CTA', () => { @@ -98,9 +95,8 @@ describe('JiraIssuesFields', () => { }); } } else { - it('does not render checkbox and input field', () => { + it('does not render enable checkbox', () => { expect(findEnableCheckbox().exists()).toBe(false); - expect(findProjectKey().exists()).toBe(false); }); it('renders the Premium CTA', () => { @@ -122,12 +118,8 @@ describe('JiraIssuesFields', () => { createComponent({ props: { initialProjectKey: '' } }); }); - it('renders disabled project_key input', () => { - const projectKey = findProjectKey(); - - expect(projectKey.exists()).toBe(true); - expect(projectKey.attributes('disabled')).toBe('disabled'); - expect(projectKey.attributes('required')).toBeUndefined(); + it('does not render project_key input', () => { + expect(findProjectKey().exists()).toBe(false); }); // As per https://vuejs.org/v2/guide/forms.html#Checkbox-1, @@ -137,45 +129,23 @@ describe('JiraIssuesFields', () => { }); describe('when isInheriting = true', () => { - it('disables checkbox and sets input as readonly', () => { + it('disables checkbox', () => { createComponent({ isInheriting: true }); expect(findEnableCheckboxDisabled()).toBe('disabled'); - expect(findProjectKey().attributes('readonly')).toBe('readonly'); }); }); describe('on enable issues', () => { - it('enables project_key input as required', async () => { + it('renders project_key input as required', async () => { await setEnableCheckbox(true); - expect(findProjectKey().attributes('disabled')).toBeUndefined(); + expect(findProjectKey().exists()).toBe(true); expect(findProjectKey().attributes('required')).toBe('required'); }); }); }); - it('contains link to editProjectPath', () => { - createComponent(); - - expect(wrapper.find(`a[href="${defaultProps.editProjectPath}"]`).exists()).toBe(true); - }); - - describe('GitLab issues warning', () => { - it.each` - gitlabIssuesEnabled | scenario - ${true} | ${'displays conflict warning'} - ${false} | ${'does not display conflict warning'} - `( - '$scenario when `gitlabIssuesEnabled` is `$gitlabIssuesEnabled`', - ({ gitlabIssuesEnabled }) => { - createComponent({ props: { gitlabIssuesEnabled } }); - - expect(findConflictWarning().exists()).toBe(gitlabIssuesEnabled); - }, - ); - }); - describe('Vulnerabilities creation', () => { beforeEach(() => { createComponent(); |