diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/frontend/releases/stores/modules/detail/getters_spec.js | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/frontend/releases/stores/modules/detail/getters_spec.js')
-rw-r--r-- | spec/frontend/releases/stores/modules/detail/getters_spec.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/frontend/releases/stores/modules/detail/getters_spec.js b/spec/frontend/releases/stores/modules/detail/getters_spec.js index c32969c131e..c42c6c00f56 100644 --- a/spec/frontend/releases/stores/modules/detail/getters_spec.js +++ b/spec/frontend/releases/stores/modules/detail/getters_spec.js @@ -1,3 +1,4 @@ +import { s__ } from '~/locale'; import * as getters from '~/releases/stores/modules/edit_new/getters'; describe('Release edit/new getters', () => { @@ -145,6 +146,8 @@ describe('Release edit/new getters', () => { ], }, }, + // tag has an existing release + existingRelease: {}, }; actualErrors = getters.validationErrors(state); @@ -158,6 +161,14 @@ describe('Release edit/new getters', () => { expect(actualErrors).toMatchObject(expectedErrors); }); + it('returns a validation error if the tag has an existing release', () => { + const expectedErrors = { + existingRelease: true, + }; + + expect(actualErrors).toMatchObject(expectedErrors); + }); + it('returns a validation error if links share a URL', () => { const expectedErrors = { assets: { @@ -369,4 +380,25 @@ describe('Release edit/new getters', () => { expect(actualVariables).toEqual(expectedVariables); }); }); + + describe('formattedReleaseNotes', () => { + it.each` + description | includeTagNotes | tagNotes | included + ${'release notes'} | ${true} | ${'tag notes'} | ${true} + ${'release notes'} | ${true} | ${''} | ${false} + ${'release notes'} | ${false} | ${'tag notes'} | ${false} + `( + 'should include tag notes=$included when includeTagNotes=$includeTagNotes and tagNotes=$tagNotes', + ({ description, includeTagNotes, tagNotes, included }) => { + const state = { release: { description }, includeTagNotes, tagNotes }; + + const text = `### ${s__('Releases|Tag message')}\n\n${tagNotes}\n`; + if (included) { + expect(getters.formattedReleaseNotes(state)).toContain(text); + } else { + expect(getters.formattedReleaseNotes(state)).not.toContain(text); + } + }, + ); + }); }); |