diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/frontend/releases/components/app_edit_new_spec.js | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) | |
download | gitlab-ce-15.9.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/frontend/releases/components/app_edit_new_spec.js')
-rw-r--r-- | spec/frontend/releases/components/app_edit_new_spec.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/frontend/releases/components/app_edit_new_spec.js b/spec/frontend/releases/components/app_edit_new_spec.js index 649d8eef6ec..bd61e4537f9 100644 --- a/spec/frontend/releases/components/app_edit_new_spec.js +++ b/spec/frontend/releases/components/app_edit_new_spec.js @@ -5,11 +5,13 @@ import Vuex from 'vuex'; import { nextTick } from 'vue'; import { GlDatepicker, GlFormCheckbox } from '@gitlab/ui'; import originalOneReleaseForEditingQueryResponse from 'test_fixtures/graphql/releases/graphql/queries/one_release_for_editing.query.graphql.json'; +import { HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { convertOneReleaseGraphQLResponse } from '~/releases/util'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import setWindowLocation from 'helpers/set_window_location_helper'; import { TEST_HOST } from 'helpers/test_constants'; import ReleaseEditNewApp from '~/releases/components/app_edit_new.vue'; +import { putCreateReleaseNotification } from '~/releases/release_notification_service'; import AssetLinksForm from '~/releases/components/asset_links_form.vue'; import ConfirmDeleteModal from '~/releases/components/confirm_delete_modal.vue'; import { BACK_URL_PARAM } from '~/releases/constants'; @@ -19,6 +21,8 @@ const originalRelease = originalOneReleaseForEditingQueryResponse.data.project.r const originalMilestones = originalRelease.milestones; const releasesPagePath = 'path/to/releases/page'; const upcomingReleaseDocsPath = 'path/to/upcoming/release/docs'; +const projectPath = 'project/path'; +jest.mock('~/releases/release_notification_service'); describe('Release edit/new component', () => { let wrapper; @@ -32,6 +36,7 @@ describe('Release edit/new component', () => { state = { release, isExistingRelease: true, + projectPath, markdownDocsPath: 'path/to/markdown/docs', releasesPagePath, projectId: '8', @@ -91,7 +96,7 @@ describe('Release edit/new component', () => { mock = new MockAdapter(axios); gon.api_version = 'v4'; - mock.onGet('/api/v4/projects/8/milestones').reply(200, originalMilestones); + mock.onGet('/api/v4/projects/8/milestones').reply(HTTP_STATUS_OK, originalMilestones); release = convertOneReleaseGraphQLResponse(originalOneReleaseForEditingQueryResponse).data; }); @@ -125,7 +130,7 @@ describe('Release edit/new component', () => { it('renders the description text at the top of the page', () => { expect(wrapper.find('.js-subtitle-text').text()).toBe( - 'Releases are based on Git tags. We recommend tags that use semantic versioning, for example v1.0.0, v2.1.0-pre.', + 'Releases are based on Git tags. We recommend tags that use semantic versioning, for example 1.0.0, 2.1.0-pre.', ); }); @@ -163,6 +168,13 @@ describe('Release edit/new component', () => { expect(actions.saveRelease).toHaveBeenCalledTimes(1); }); + + it('sets release created notification when the form is submitted', () => { + findForm().trigger('submit'); + const releaseName = originalOneReleaseForEditingQueryResponse.data.project.release.name; + expect(putCreateReleaseNotification).toHaveBeenCalledTimes(1); + expect(putCreateReleaseNotification).toHaveBeenCalledWith(projectPath, releaseName); + }); }); describe(`when the URL does not contain a "${BACK_URL_PARAM}" parameter`, () => { |