summaryrefslogtreecommitdiff
path: root/spec/javascripts/notes/stores/mutation_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/notes/stores/mutation_spec.js')
-rw-r--r--spec/javascripts/notes/stores/mutation_spec.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/javascripts/notes/stores/mutation_spec.js b/spec/javascripts/notes/stores/mutation_spec.js
index 1ecfe914859..9d652ba9f1e 100644
--- a/spec/javascripts/notes/stores/mutation_spec.js
+++ b/spec/javascripts/notes/stores/mutation_spec.js
@@ -30,11 +30,13 @@ describe('Notes Store mutations', () => {
expect(state).toEqual({
discussions: [noteData],
});
+
expect(state.discussions.length).toBe(1);
});
it('should not add the same note to the notes array', () => {
mutations.ADD_NEW_NOTE(state, note);
+
expect(state.discussions.length).toBe(1);
});
});
@@ -106,6 +108,7 @@ describe('Notes Store mutations', () => {
};
mutations.SET_NOTES_DATA(state, notesDataMock);
+
expect(state.notesData).toEqual(notesDataMock);
});
});
@@ -117,6 +120,7 @@ describe('Notes Store mutations', () => {
};
mutations.SET_NOTEABLE_DATA(state, noteableDataMock);
+
expect(state.noteableData).toEqual(noteableDataMock);
});
});
@@ -128,6 +132,7 @@ describe('Notes Store mutations', () => {
};
mutations.SET_USER_DATA(state, userDataMock);
+
expect(state.userData).toEqual(userDataMock);
});
});
@@ -151,6 +156,7 @@ describe('Notes Store mutations', () => {
};
mutations.SET_INITIAL_DISCUSSIONS(state, [note, legacyNote]);
+
expect(state.discussions[0].id).toEqual(note.id);
expect(state.discussions[1].notes[0].note).toBe(legacyNote.notes[0].note);
expect(state.discussions[2].notes[0].note).toBe(legacyNote.notes[1].note);
@@ -200,6 +206,7 @@ describe('Notes Store mutations', () => {
};
mutations.SET_LAST_FETCHED_AT(state, 'timestamp');
+
expect(state.lastFetchedAt).toEqual('timestamp');
});
});
@@ -211,6 +218,7 @@ describe('Notes Store mutations', () => {
};
mutations.SET_TARGET_NOTE_HASH(state, 'hash');
+
expect(state.targetNoteHash).toEqual('hash');
});
});
@@ -221,6 +229,7 @@ describe('Notes Store mutations', () => {
discussions: [],
};
mutations.SHOW_PLACEHOLDER_NOTE(state, note);
+
expect(state.discussions[0].isPlaceholderNote).toEqual(true);
});
});
@@ -261,6 +270,7 @@ describe('Notes Store mutations', () => {
awardName: 'bath_tone3',
};
mutations.TOGGLE_AWARD(state, data);
+
expect(state.discussions[0].award_emoji.length).toEqual(2);
});
});
@@ -316,6 +326,7 @@ describe('Notes Store mutations', () => {
};
mutations.CLOSE_ISSUE(state);
+
expect(state.noteableData.state).toEqual('closed');
});
});
@@ -333,6 +344,7 @@ describe('Notes Store mutations', () => {
};
mutations.REOPEN_ISSUE(state);
+
expect(state.noteableData.state).toEqual('reopened');
});
});
@@ -350,6 +362,7 @@ describe('Notes Store mutations', () => {
};
mutations.TOGGLE_STATE_BUTTON_LOADING(state, true);
+
expect(state.isToggleStateButtonLoading).toEqual(true);
});
@@ -365,6 +378,7 @@ describe('Notes Store mutations', () => {
};
mutations.TOGGLE_STATE_BUTTON_LOADING(state, false);
+
expect(state.isToggleStateButtonLoading).toEqual(false);
});
});
@@ -376,6 +390,7 @@ describe('Notes Store mutations', () => {
};
mutations.SET_NOTES_FETCHED_STATE(state, true);
+
expect(state.isNotesFetched).toEqual(true);
});
});