diff options
Diffstat (limited to 'spec/frontend/diffs/store/mutations_spec.js')
-rw-r--r-- | spec/frontend/diffs/store/mutations_spec.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/frontend/diffs/store/mutations_spec.js b/spec/frontend/diffs/store/mutations_spec.js index fc9ba223d5a..c104fcd5fb9 100644 --- a/spec/frontend/diffs/store/mutations_spec.js +++ b/spec/frontend/diffs/store/mutations_spec.js @@ -633,16 +633,36 @@ describe('DiffsStoreMutations', () => { }); }); - describe('VIEW_DIFF_FILE', () => { + describe('SET_CURRENT_DIFF_FILE', () => { it('updates currentDiffFileId', () => { const state = createState(); - mutations[types.VIEW_DIFF_FILE](state, 'somefileid'); + mutations[types.SET_CURRENT_DIFF_FILE](state, 'somefileid'); expect(state.currentDiffFileId).toBe('somefileid'); }); }); + describe('SET_DIFF_FILE_VIEWED', () => { + let state; + + beforeEach(() => { + state = { + viewedDiffFileIds: { 123: true }, + }; + }); + + it.each` + id | bool | outcome + ${'abc'} | ${true} | ${{ 123: true, abc: true }} + ${'123'} | ${false} | ${{ 123: false }} + `('sets the viewed files list to $bool for the id $id', ({ id, bool, outcome }) => { + mutations[types.SET_DIFF_FILE_VIEWED](state, { id, seen: bool }); + + expect(state.viewedDiffFileIds).toEqual(outcome); + }); + }); + describe('Set highlighted row', () => { it('sets highlighted row', () => { const state = createState(); |