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/notes/stores/mutation_spec.js')
-rw-r--r--spec/frontend/notes/stores/mutation_spec.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/frontend/notes/stores/mutation_spec.js b/spec/frontend/notes/stores/mutation_spec.js
index 46b4081f6f6..ee772afbc03 100644
--- a/spec/frontend/notes/stores/mutation_spec.js
+++ b/spec/frontend/notes/stores/mutation_spec.js
@@ -8,6 +8,7 @@ import {
userDataMock,
noteableDataMock,
individualNote,
+ notesWithDescriptionChanges,
} from '../mock_data';
const RESOLVED_NOTE = { resolvable: true, resolved: true };
@@ -579,4 +580,27 @@ describe('Notes Store mutations', () => {
expect(state.convertedDisscussionIds).not.toContain(discussion.id);
});
});
+
+ describe('RECEIVE_DESCRIPTION_VERSION', () => {
+ const descriptionVersion = notesWithDescriptionChanges[0].notes[0].note;
+ const versionId = notesWithDescriptionChanges[0].notes[0].id;
+ const state = {};
+
+ it('adds a descriptionVersion', () => {
+ mutations.RECEIVE_DESCRIPTION_VERSION(state, { descriptionVersion, versionId });
+ expect(state.descriptionVersions[versionId]).toBe(descriptionVersion);
+ });
+ });
+
+ describe('RECEIVE_DELETE_DESCRIPTION_VERSION', () => {
+ const descriptionVersion = notesWithDescriptionChanges[0].notes[0].note;
+ const versionId = notesWithDescriptionChanges[0].notes[0].id;
+ const state = { descriptionVersions: { [versionId]: descriptionVersion } };
+ const deleted = 'Deleted';
+
+ it('updates descriptionVersion to "Deleted"', () => {
+ mutations.RECEIVE_DELETE_DESCRIPTION_VERSION(state, { [versionId]: deleted });
+ expect(state.descriptionVersions[versionId]).toBe(deleted);
+ });
+ });
});