diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /spec/frontend/vue_merge_request_widget/deployment | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'spec/frontend/vue_merge_request_widget/deployment')
5 files changed, 21 insertions, 100 deletions
diff --git a/spec/frontend/vue_merge_request_widget/deployment/deployment_action_button_spec.js b/spec/frontend/vue_merge_request_widget/deployment/deployment_action_button_spec.js index 1bad5dacefa..785515ae846 100644 --- a/spec/frontend/vue_merge_request_widget/deployment/deployment_action_button_spec.js +++ b/spec/frontend/vue_merge_request_widget/deployment/deployment_action_button_spec.js @@ -25,10 +25,6 @@ describe('Deployment action button', () => { }); }; - afterEach(() => { - wrapper.destroy(); - }); - describe('when passed only icon via props', () => { beforeEach(() => { factory({ diff --git a/spec/frontend/vue_merge_request_widget/deployment/deployment_actions_spec.js b/spec/frontend/vue_merge_request_widget/deployment/deployment_actions_spec.js index 41df485b0de..f2b78dedf3a 100644 --- a/spec/frontend/vue_merge_request_widget/deployment/deployment_actions_spec.js +++ b/spec/frontend/vue_merge_request_widget/deployment/deployment_actions_spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import { visitUrl } from '~/lib/utils/url_utility'; import { @@ -21,7 +21,7 @@ import { retryDetails, } from './deployment_mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/lib/utils/url_utility'); jest.mock('~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'); @@ -30,11 +30,6 @@ describe('DeploymentAction component', () => { let executeActionSpy; const factory = (options = {}) => { - // This destroys any wrappers created before a nested call to factory reassigns it - if (wrapper && wrapper.destroy) { - wrapper.destroy(); - } - wrapper = mount(DeploymentActions, options); }; @@ -54,7 +49,6 @@ describe('DeploymentAction component', () => { }); afterEach(() => { - wrapper.destroy(); confirmAction.mockReset(); }); diff --git a/spec/frontend/vue_merge_request_widget/deployment/deployment_list_spec.js b/spec/frontend/vue_merge_request_widget/deployment/deployment_list_spec.js index 948d7ebab5e..77dac4204db 100644 --- a/spec/frontend/vue_merge_request_widget/deployment/deployment_list_spec.js +++ b/spec/frontend/vue_merge_request_widget/deployment/deployment_list_spec.js @@ -28,7 +28,6 @@ describe('~/vue_merge_request_widget/components/deployment/deployment_list.vue', afterEach(() => { wrapper?.destroy?.(); - wrapper = null; }); describe('with few deployments', () => { diff --git a/spec/frontend/vue_merge_request_widget/deployment/deployment_spec.js b/spec/frontend/vue_merge_request_widget/deployment/deployment_spec.js index f310f7669a9..234491c531a 100644 --- a/spec/frontend/vue_merge_request_widget/deployment/deployment_spec.js +++ b/spec/frontend/vue_merge_request_widget/deployment/deployment_spec.js @@ -16,10 +16,6 @@ describe('Deployment component', () => { let wrapper; const factory = (options = {}) => { - // This destroys any wrappers created before a nested call to factory reassigns it - if (wrapper && wrapper.destroy) { - wrapper.destroy(); - } wrapper = mount(DeploymentComponent, options); }; @@ -32,10 +28,6 @@ describe('Deployment component', () => { }); }); - afterEach(() => { - wrapper.destroy(); - }); - it('always renders DeploymentInfo', () => { expect(wrapper.findComponent(DeploymentInfo).exists()).toBe(true); }); diff --git a/spec/frontend/vue_merge_request_widget/deployment/deployment_view_button_spec.js b/spec/frontend/vue_merge_request_widget/deployment/deployment_view_button_spec.js index 8994fa522d0..72cfd5dd29f 100644 --- a/spec/frontend/vue_merge_request_widget/deployment/deployment_view_button_spec.js +++ b/spec/frontend/vue_merge_request_widget/deployment/deployment_view_button_spec.js @@ -2,7 +2,6 @@ import { GlDropdown, GlLink } from '@gitlab/ui'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import DeploymentViewButton from '~/vue_merge_request_widget/components/deployment/deployment_view_button.vue'; import ReviewAppLink from '~/vue_merge_request_widget/components/review_app_link.vue'; -import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue'; import { deploymentMockData } from './deployment_mock_data'; const appButtonText = { @@ -28,16 +27,11 @@ describe('Deployment View App button', () => { }); }); - afterEach(() => { - wrapper.destroy(); - }); - const findReviewAppLink = () => wrapper.findComponent(ReviewAppLink); const findMrWigdetDeploymentDropdown = () => wrapper.findComponent(GlDropdown); const findMrWigdetDeploymentDropdownIcon = () => wrapper.findByTestId('mr-wigdet-deployment-dropdown-icon'); const findDeployUrlMenuItems = () => wrapper.findAllComponents(GlLink); - const findCopyButton = () => wrapper.findComponent(ModalCopyButton); describe('text', () => { it('renders text as passed', () => { @@ -46,93 +40,39 @@ describe('Deployment View App button', () => { }); describe('without changes', () => { - let deployment; - beforeEach(() => { - deployment = { ...deploymentMockData, changes: null }; - }); - - describe('with safe url', () => { - beforeEach(() => { - createComponent({ - propsData: { - deployment, - appButtonText, - }, - }); - }); - - it('renders the link to the review app without dropdown', () => { - expect(findMrWigdetDeploymentDropdown().exists()).toBe(false); - expect(findReviewAppLink().attributes('href')).toBe(deployment.external_url); + createComponent({ + propsData: { + deployment: { ...deploymentMockData, changes: null }, + appButtonText, + }, }); }); - describe('without safe URL', () => { - beforeEach(() => { - deployment = { ...deployment, external_url: 'postgres://example' }; - createComponent({ - propsData: { - deployment, - appButtonText, - }, - }); - }); - - it('renders the link as a copy button', () => { - expect(findMrWigdetDeploymentDropdown().exists()).toBe(false); - expect(findCopyButton().props('text')).toBe(deployment.external_url); - }); + it('renders the link to the review app without dropdown', () => { + expect(findMrWigdetDeploymentDropdown().exists()).toBe(false); }); }); describe('with a single change', () => { - let deployment; - let change; - beforeEach(() => { - [change] = deploymentMockData.changes; - deployment = { ...deploymentMockData, changes: [change] }; - }); - - describe('with safe URL', () => { - beforeEach(() => { - createComponent({ - propsData: { - deployment, - appButtonText, - }, - }); - }); - - it('renders the link to the review app without dropdown', () => { - expect(findMrWigdetDeploymentDropdown().exists()).toBe(false); - expect(findMrWigdetDeploymentDropdownIcon().exists()).toBe(false); + createComponent({ + propsData: { + deployment: { ...deploymentMockData, changes: [deploymentMockData.changes[0]] }, + appButtonText, + }, }); + }); - it('renders the link to the review app linked to to the first change', () => { - const expectedUrl = deploymentMockData.changes[0].external_url; - - expect(findReviewAppLink().attributes('href')).toBe(expectedUrl); - }); + it('renders the link to the review app without dropdown', () => { + expect(findMrWigdetDeploymentDropdown().exists()).toBe(false); + expect(findMrWigdetDeploymentDropdownIcon().exists()).toBe(false); }); - describe('with unsafe URL', () => { - beforeEach(() => { - change = { ...change, external_url: 'postgres://example' }; - deployment = { ...deployment, changes: [change] }; - createComponent({ - propsData: { - deployment, - appButtonText, - }, - }); - }); + it('renders the link to the review app linked to to the first change', () => { + const expectedUrl = deploymentMockData.changes[0].external_url; - it('renders the link as a copy button', () => { - expect(findMrWigdetDeploymentDropdown().exists()).toBe(false); - expect(findCopyButton().props('text')).toBe(change.external_url); - }); + expect(findReviewAppLink().attributes('href')).toBe(expectedUrl); }); }); |