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')
-rw-r--r--spec/frontend/notes/stores/actions_spec.js9
-rw-r--r--spec/frontend/notes/stores/getters_spec.js13
-rw-r--r--spec/frontend/notes/stores/mutation_spec.js3
3 files changed, 22 insertions, 3 deletions
diff --git a/spec/frontend/notes/stores/actions_spec.js b/spec/frontend/notes/stores/actions_spec.js
index 4681f3aa429..920959f41e7 100644
--- a/spec/frontend/notes/stores/actions_spec.js
+++ b/spec/frontend/notes/stores/actions_spec.js
@@ -1144,9 +1144,14 @@ describe('Actions Notes Store', () => {
it('calls the correct mutation with the correct args', done => {
testAction(
actions.setDiscussionSortDirection,
- notesConstants.DESC,
+ { direction: notesConstants.DESC, persist: false },
{},
- [{ type: mutationTypes.SET_DISCUSSIONS_SORT, payload: notesConstants.DESC }],
+ [
+ {
+ type: mutationTypes.SET_DISCUSSIONS_SORT,
+ payload: { direction: notesConstants.DESC, persist: false },
+ },
+ ],
[],
done,
);
diff --git a/spec/frontend/notes/stores/getters_spec.js b/spec/frontend/notes/stores/getters_spec.js
index a07aa45d812..1a369caee49 100644
--- a/spec/frontend/notes/stores/getters_spec.js
+++ b/spec/frontend/notes/stores/getters_spec.js
@@ -6,6 +6,7 @@ import {
noteableDataMock,
individualNote,
collapseNotesMock,
+ discussionMock,
discussion1,
discussion2,
discussion3,
@@ -65,6 +66,18 @@ describe('Getters Notes Store', () => {
it('should return all discussions in the store', () => {
expect(getters.discussions(state)).toEqual([individualNote]);
});
+
+ it('should transform discussion to individual notes in timeline view', () => {
+ state.discussions = [discussionMock];
+ state.isTimelineEnabled = true;
+
+ expect(getters.discussions(state).length).toEqual(discussionMock.notes.length);
+ getters.discussions(state).forEach(discussion => {
+ expect(discussion.individual_note).toBe(true);
+ expect(discussion.id).toBe(discussion.notes[0].id);
+ expect(discussion.created_at).toBe(discussion.notes[0].created_at);
+ });
+ });
});
describe('resolvedDiscussionsById', () => {
diff --git a/spec/frontend/notes/stores/mutation_spec.js b/spec/frontend/notes/stores/mutation_spec.js
index b953bffc4fe..2618c3a53b8 100644
--- a/spec/frontend/notes/stores/mutation_spec.js
+++ b/spec/frontend/notes/stores/mutation_spec.js
@@ -680,9 +680,10 @@ describe('Notes Store mutations', () => {
});
it('sets sort order', () => {
- mutations.SET_DISCUSSIONS_SORT(state, DESC);
+ mutations.SET_DISCUSSIONS_SORT(state, { direction: DESC, persist: false });
expect(state.discussionSortOrder).toBe(DESC);
+ expect(state.persistSortOrder).toBe(false);
});
});