diff options
Diffstat (limited to 'spec/frontend/notes/stores/mutation_spec.js')
-rw-r--r-- | spec/frontend/notes/stores/mutation_spec.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/frontend/notes/stores/mutation_spec.js b/spec/frontend/notes/stores/mutation_spec.js index 0ad18ba9b6a..b953bffc4fe 100644 --- a/spec/frontend/notes/stores/mutation_spec.js +++ b/spec/frontend/notes/stores/mutation_spec.js @@ -833,13 +833,27 @@ describe('Notes Store mutations', () => { state = { noteableData: { confidential: false } }; }); - it('sets sort order', () => { + it('should set issuable as confidential', () => { mutations.SET_ISSUE_CONFIDENTIAL(state, true); expect(state.noteableData.confidential).toBe(true); }); }); + describe('SET_ISSUABLE_LOCK', () => { + let state; + + beforeEach(() => { + state = { noteableData: { discussion_locked: false } }; + }); + + it('should set issuable as locked', () => { + mutations.SET_ISSUABLE_LOCK(state, true); + + expect(state.noteableData.discussion_locked).toBe(true); + }); + }); + describe('UPDATE_ASSIGNEES', () => { it('should update assignees', () => { const state = { @@ -851,4 +865,20 @@ describe('Notes Store mutations', () => { expect(state.noteableData.assignees).toEqual([userDataMock.id]); }); }); + + describe('UPDATE_DISCUSSION_POSITION', () => { + it('should upate the discusion position', () => { + const discussion1 = { id: 1, position: { line_code: 'abc_1_1' } }; + const discussion2 = { id: 2, position: { line_code: 'abc_2_2' } }; + const discussion3 = { id: 3, position: { line_code: 'abc_3_3' } }; + const state = { + discussions: [discussion1, discussion2, discussion3], + }; + const discussion1Position = { ...discussion1.position }; + const position = { ...discussion1Position, test: true }; + + mutations.UPDATE_DISCUSSION_POSITION(state, { discussionId: discussion1.id, position }); + expect(state.discussions[0].position).toEqual(position); + }); + }); }); |