Commit 3b7ea6b6 authored by Donald Cook's avatar Donald Cook

Added mutation test

parent 49a4cc3a
......@@ -298,9 +298,9 @@ export default {
[types.REQUEST_DELETE_DESCRIPTION_VERSION](state) {
state.isLoadingDescriptionVersion = true;
},
[types.RECEIVE_DELETE_DESCRIPTION_VERSION](state, versionId) {
[types.RECEIVE_DELETE_DESCRIPTION_VERSION](state, descriptionVersion) {
state.isLoadingDescriptionVersion = false;
Object.assign(state.descriptionVersions, versionId);
Object.assign(state.descriptionVersions, descriptionVersion);
},
[types.RECEIVE_DELETE_DESCRIPTION_VERSION_ERROR](state) {
state.isLoadingDescriptionVersion = false;
......
......@@ -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]).toContain(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]).toContain(deleted);
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment