diff options
Diffstat (limited to 'spec/javascripts/notes/stores/getters_spec.js')
-rw-r--r-- | spec/javascripts/notes/stores/getters_spec.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/javascripts/notes/stores/getters_spec.js b/spec/javascripts/notes/stores/getters_spec.js index 815cc09621f..41599e00122 100644 --- a/spec/javascripts/notes/stores/getters_spec.js +++ b/spec/javascripts/notes/stores/getters_spec.js @@ -7,9 +7,13 @@ import { collapseNotesMock, } from '../mock_data'; +const discussionWithTwoUnresolvedNotes = 'merge_requests/resolved_diff_discussion.json'; + describe('Getters Notes Store', () => { let state; + preloadFixtures(discussionWithTwoUnresolvedNotes); + beforeEach(() => { state = { discussions: [individualNote], @@ -22,12 +26,26 @@ describe('Getters Notes Store', () => { noteableData: noteableDataMock, }; }); + describe('discussions', () => { it('should return all discussions in the store', () => { expect(getters.discussions(state)).toEqual([individualNote]); }); }); + describe('resolvedDiscussionsById', () => { + it('ignores unresolved system notes', () => { + const [discussion] = getJSONFixture(discussionWithTwoUnresolvedNotes); + discussion.notes[0].resolved = true; + discussion.notes[1].resolved = false; + state.discussions.push(discussion); + + expect(getters.resolvedDiscussionsById(state)).toEqual({ + [discussion.id]: discussion, + }); + }); + }); + describe('Collapsed notes', () => { const stateCollapsedNotes = { discussions: collapseNotesMock, |