Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/releases/stores/modules/detail/getters_spec.js')
-rw-r--r--spec/frontend/releases/stores/modules/detail/getters_spec.js32
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);
+ }
+ },
+ );
+ });
});