diff options
Diffstat (limited to 'spec/frontend/integrations/edit/components/integration_form_spec.js')
-rw-r--r-- | spec/frontend/integrations/edit/components/integration_form_spec.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/frontend/integrations/edit/components/integration_form_spec.js b/spec/frontend/integrations/edit/components/integration_form_spec.js index 4dd38c959f8..97e77ac87ab 100644 --- a/spec/frontend/integrations/edit/components/integration_form_spec.js +++ b/spec/frontend/integrations/edit/components/integration_form_spec.js @@ -5,6 +5,7 @@ import IntegrationForm from '~/integrations/edit/components/integration_form.vue import OverrideDropdown from '~/integrations/edit/components/override_dropdown.vue'; import ActiveCheckbox from '~/integrations/edit/components/active_checkbox.vue'; import ConfirmationModal from '~/integrations/edit/components/confirmation_modal.vue'; +import ResetConfirmationModal from '~/integrations/edit/components/reset_confirmation_modal.vue'; import JiraTriggerFields from '~/integrations/edit/components/jira_trigger_fields.vue'; import JiraIssuesFields from '~/integrations/edit/components/jira_issues_fields.vue'; import TriggerFields from '~/integrations/edit/components/trigger_fields.vue'; @@ -44,6 +45,8 @@ describe('IntegrationForm', () => { const findOverrideDropdown = () => wrapper.find(OverrideDropdown); const findActiveCheckbox = () => wrapper.find(ActiveCheckbox); const findConfirmationModal = () => wrapper.find(ConfirmationModal); + const findResetConfirmationModal = () => wrapper.find(ResetConfirmationModal); + const findResetButton = () => wrapper.find('[data-testid="reset-button"]'); const findJiraTriggerFields = () => wrapper.find(JiraTriggerFields); const findJiraIssuesFields = () => wrapper.find(JiraIssuesFields); const findTriggerFields = () => wrapper.find(TriggerFields); @@ -75,6 +78,29 @@ describe('IntegrationForm', () => { expect(findConfirmationModal().exists()).toBe(true); }); + + describe('resetPath is empty', () => { + it('does not render ResetConfirmationModal and button', () => { + createComponent({ + integrationLevel: integrationLevels.INSTANCE, + }); + + expect(findResetButton().exists()).toBe(false); + expect(findResetConfirmationModal().exists()).toBe(false); + }); + }); + + describe('resetPath is present', () => { + it('renders ResetConfirmationModal and button', () => { + createComponent({ + integrationLevel: integrationLevels.INSTANCE, + resetPath: 'resetPath', + }); + + expect(findResetButton().exists()).toBe(true); + expect(findResetConfirmationModal().exists()).toBe(true); + }); + }); }); describe('integrationLevel is group', () => { @@ -85,6 +111,29 @@ describe('IntegrationForm', () => { expect(findConfirmationModal().exists()).toBe(true); }); + + describe('resetPath is empty', () => { + it('does not render ResetConfirmationModal and button', () => { + createComponent({ + integrationLevel: integrationLevels.GROUP, + }); + + expect(findResetButton().exists()).toBe(false); + expect(findResetConfirmationModal().exists()).toBe(false); + }); + }); + + describe('resetPath is present', () => { + it('renders ResetConfirmationModal and button', () => { + createComponent({ + integrationLevel: integrationLevels.GROUP, + resetPath: 'resetPath', + }); + + expect(findResetButton().exists()).toBe(true); + expect(findResetConfirmationModal().exists()).toBe(true); + }); + }); }); describe('integrationLevel is project', () => { @@ -95,6 +144,16 @@ describe('IntegrationForm', () => { expect(findConfirmationModal().exists()).toBe(false); }); + + it('does not render ResetConfirmationModal and button', () => { + createComponent({ + integrationLevel: 'project', + resetPath: 'resetPath', + }); + + expect(findResetButton().exists()).toBe(false); + expect(findResetConfirmationModal().exists()).toBe(false); + }); }); describe('type is "slack"', () => { |