Commit f8efaf1b authored by Simon Knox's avatar Simon Knox Committed by Fatih Acet

issue note store

parent 3a8d646f
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
noteType: constants.COMMENT, noteType: constants.COMMENT,
// Can't use mapGetters, // Can't use mapGetters,
// this needs to be in the data object because it belongs to the state // this needs to be in the data object because it belongs to the state
issueState: this.$store.getters.getIssueData.state, issueState: this.$store.getters.getNoteableData.state,
isSubmitting: false, isSubmitting: false,
isSubmitButtonDisabled: true, isSubmitButtonDisabled: true,
}; };
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
...mapGetters([ ...mapGetters([
'getCurrentUserLastNote', 'getCurrentUserLastNote',
'getUserData', 'getUserData',
'getIssueData', 'getNoteableData',
'getNotesData', 'getNotesData',
]), ]),
isLoggedIn() { isLoggedIn() {
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
return this.issueState === constants.OPENED || this.issueState === constants.REOPENED; return this.issueState === constants.OPENED || this.issueState === constants.REOPENED;
}, },
canCreateNote() { canCreateNote() {
return this.getIssueData.current_user.can_create_note; return this.getNoteableData.current_user.can_create_note;
}, },
issueActionButtonTitle() { issueActionButtonTitle() {
if (this.note.length) { if (this.note.length) {
...@@ -85,16 +85,16 @@ ...@@ -85,16 +85,16 @@
return this.getNotesData.quickActionsDocsPath; return this.getNotesData.quickActionsDocsPath;
}, },
markdownPreviewPath() { markdownPreviewPath() {
return this.getIssueData.preview_note_path; return this.getNoteableData.preview_note_path;
}, },
author() { author() {
return this.getUserData; return this.getUserData;
}, },
canUpdateIssue() { canUpdateIssue() {
return this.getIssueData.current_user.can_update; return this.getNoteableData.current_user.can_update;
}, },
endpoint() { endpoint() {
return this.getIssueData.create_note_path; return this.getNoteableData.create_note_path;
}, },
}, },
methods: { methods: {
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
data: { data: {
note: { note: {
noteable_type: constants.NOTEABLE_TYPE, noteable_type: constants.NOTEABLE_TYPE,
noteable_id: this.getIssueData.id, noteable_id: this.getNoteableData.id,
note: this.note, note: this.note,
}, },
}, },
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
}, },
initAutoSave() { initAutoSave() {
if (this.isLoggedIn) { if (this.isLoggedIn) {
this.autosave = new Autosave($(this.$refs.textarea), ['Note', 'Issue', this.getIssueData.id], 'issue'); this.autosave = new Autosave($(this.$refs.textarea), ['Note', 'Issue', this.getNoteableData.id], 'issue');
} }
}, },
initTaskList() { initTaskList() {
...@@ -266,9 +266,9 @@ ...@@ -266,9 +266,9 @@
<div class="error-alert"></div> <div class="error-alert"></div>
<issue-warning <issue-warning
v-if="hasWarning(getIssueData)" v-if="hasWarning(getNoteableData)"
:is-locked="isLocked(getIssueData)" :is-locked="isLocked(getNoteableData)"
:is-confidential="isConfidential(getIssueData)" :is-confidential="isConfidential(getNoteableData)"
/> />
<markdown-field <markdown-field
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
], ],
computed: { computed: {
...mapGetters([ ...mapGetters([
'getIssueData', 'getNoteableData',
]), ]),
discussion() { discussion() {
return this.note.notes[0]; return this.note.notes[0];
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
return this.discussion.author; return this.discussion.author;
}, },
canReply() { canReply() {
return this.getIssueData.current_user.can_create_note; return this.getNoteableData.current_user.can_create_note;
}, },
newNotePath() { newNotePath() {
return this.getIssueData.create_note_path; return this.getNoteableData.create_note_path;
}, },
lastUpdatedBy() { lastUpdatedBy() {
const { notes } = this.note; const { notes } = this.note;
......
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
computed: { computed: {
...mapGetters([ ...mapGetters([
'getDiscussionLastNote', 'getDiscussionLastNote',
'getIssueData', 'getNoteableData',
'getIssueDataByProp', 'getNoteableDataByProp',
'getNotesDataByProp', 'getNotesDataByProp',
'getUserDataByProp', 'getUserDataByProp',
]), ]),
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
return `#note_${this.noteId}`; return `#note_${this.noteId}`;
}, },
markdownPreviewPath() { markdownPreviewPath() {
return this.getIssueDataByProp('preview_note_path'); return this.getNoteableDataByProp('preview_note_path');
}, },
markdownDocsPath() { markdownDocsPath() {
return this.getNotesDataByProp('markdownDocsPath'); return this.getNotesDataByProp('markdownDocsPath');
...@@ -129,9 +129,9 @@ ...@@ -129,9 +129,9 @@
class="edit-note common-note-form js-quick-submit gfm-form"> class="edit-note common-note-form js-quick-submit gfm-form">
<issue-warning <issue-warning
v-if="hasWarning(getIssueData)" v-if="hasWarning(getNoteableData)"
:is-locked="isLocked(getIssueData)" :is-locked="isLocked(getNoteableData)"
:is-confidential="isConfidential(getIssueData)" :is-confidential="isConfidential(getNoteableData)"
/> />
<markdown-field <markdown-field
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
export default { export default {
name: 'issueNotesApp', name: 'issueNotesApp',
props: { props: {
issueData: { noteableData: {
type: Object, type: Object,
required: true, required: true,
}, },
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
actionToggleAward: 'toggleAward', actionToggleAward: 'toggleAward',
scrollToNoteIfNeeded: 'scrollToNoteIfNeeded', scrollToNoteIfNeeded: 'scrollToNoteIfNeeded',
setNotesData: 'setNotesData', setNotesData: 'setNotesData',
setIssueData: 'setIssueData', setNoteableData: 'setNoteableData',
setUserData: 'setUserData', setUserData: 'setUserData',
setLastFetchedAt: 'setLastFetchedAt', setLastFetchedAt: 'setLastFetchedAt',
setTargetNoteHash: 'setTargetNoteHash', setTargetNoteHash: 'setTargetNoteHash',
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
}, },
created() { created() {
this.setNotesData(this.notesData); this.setNotesData(this.notesData);
this.setIssueData(this.issueData); this.setNoteableData(this.noteableData);
this.setUserData(this.userData); this.setUserData(this.userData);
}, },
mounted() { mounted() {
......
...@@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({ ...@@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
const notesDataset = document.getElementById('js-vue-notes').dataset; const notesDataset = document.getElementById('js-vue-notes').dataset;
return { return {
issueData: JSON.parse(notesDataset.issueData), noteableData: JSON.parse(notesDataset.noteableData),
currentUserData: JSON.parse(notesDataset.currentUserData), currentUserData: JSON.parse(notesDataset.currentUserData),
notesData: { notesData: {
lastFetchedAt: notesDataset.lastFetchedAt, lastFetchedAt: notesDataset.lastFetchedAt,
...@@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({ ...@@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
render(createElement) { render(createElement) {
return createElement('issue-notes-app', { return createElement('issue-notes-app', {
props: { props: {
issueData: this.issueData, noteableData: this.noteableData,
notesData: this.notesData, notesData: this.notesData,
userData: this.currentUserData, userData: this.currentUserData,
}, },
......
...@@ -4,7 +4,7 @@ import Poll from '../../lib/utils/poll'; ...@@ -4,7 +4,7 @@ import Poll from '../../lib/utils/poll';
import * as types from './mutation_types'; import * as types from './mutation_types';
import * as utils from './utils'; import * as utils from './utils';
import * as constants from '../constants'; import * as constants from '../constants';
import service from '../services/issue_notes_service'; import service from '../services/notes_service';
import loadAwardsHandler from '../../awards_handler'; import loadAwardsHandler from '../../awards_handler';
import sidebarTimeTrackingEventHub from '../../sidebar/event_hub'; import sidebarTimeTrackingEventHub from '../../sidebar/event_hub';
import { isInViewport, scrollToElement } from '../../lib/utils/common_utils'; import { isInViewport, scrollToElement } from '../../lib/utils/common_utils';
...@@ -12,7 +12,7 @@ import { isInViewport, scrollToElement } from '../../lib/utils/common_utils'; ...@@ -12,7 +12,7 @@ import { isInViewport, scrollToElement } from '../../lib/utils/common_utils';
let eTagPoll; let eTagPoll;
export const setNotesData = ({ commit }, data) => commit(types.SET_NOTES_DATA, data); export const setNotesData = ({ commit }, data) => commit(types.SET_NOTES_DATA, data);
export const setIssueData = ({ commit }, data) => commit(types.SET_ISSUE_DATA, data); export const setNoteableData = ({ commit }, data) => commit(types.SET_NOTEABLE_DATA, data);
export const setUserData = ({ commit }, data) => commit(types.SET_USER_DATA, data); export const setUserData = ({ commit }, data) => commit(types.SET_USER_DATA, data);
export const setLastFetchedAt = ({ commit }, data) => commit(types.SET_LAST_FETCHED_AT, data); export const setLastFetchedAt = ({ commit }, data) => commit(types.SET_LAST_FETCHED_AT, data);
export const setInitialNotes = ({ commit }, data) => commit(types.SET_INITIAL_NOTES, data); export const setInitialNotes = ({ commit }, data) => commit(types.SET_INITIAL_NOTES, data);
......
...@@ -6,8 +6,8 @@ export const targetNoteHash = state => state.targetNoteHash; ...@@ -6,8 +6,8 @@ export const targetNoteHash = state => state.targetNoteHash;
export const getNotesData = state => state.notesData; export const getNotesData = state => state.notesData;
export const getNotesDataByProp = state => prop => state.notesData[prop]; export const getNotesDataByProp = state => prop => state.notesData[prop];
export const getIssueData = state => state.issueData; export const getNoteableData = state => state.noteableData;
export const getIssueDataByProp = state => prop => state.issueData[prop]; export const getNoteableDataByProp = state => prop => state.noteableData[prop];
export const getUserData = state => state.userData || {}; export const getUserData = state => state.userData || {};
export const getUserDataByProp = state => prop => state.userData && state.userData[prop]; export const getUserDataByProp = state => prop => state.userData && state.userData[prop];
......
...@@ -15,7 +15,7 @@ export default new Vuex.Store({ ...@@ -15,7 +15,7 @@ export default new Vuex.Store({
// holds endpoints and permissions provided through haml // holds endpoints and permissions provided through haml
notesData: {}, notesData: {},
userData: {}, userData: {},
issueData: {}, noteableData: {},
}, },
actions, actions,
getters, getters,
......
...@@ -3,7 +3,7 @@ export const ADD_NEW_REPLY_TO_DISCUSSION = 'ADD_NEW_REPLY_TO_DISCUSSION'; ...@@ -3,7 +3,7 @@ export const ADD_NEW_REPLY_TO_DISCUSSION = 'ADD_NEW_REPLY_TO_DISCUSSION';
export const DELETE_NOTE = 'DELETE_NOTE'; export const DELETE_NOTE = 'DELETE_NOTE';
export const REMOVE_PLACEHOLDER_NOTES = 'REMOVE_PLACEHOLDER_NOTES'; export const REMOVE_PLACEHOLDER_NOTES = 'REMOVE_PLACEHOLDER_NOTES';
export const SET_NOTES_DATA = 'SET_NOTES_DATA'; export const SET_NOTES_DATA = 'SET_NOTES_DATA';
export const SET_ISSUE_DATA = 'SET_ISSUE_DATA'; export const SET_NOTEABLE_DATA = 'SET_NOTEABLE_DATA';
export const SET_USER_DATA = 'SET_USER_DATA'; export const SET_USER_DATA = 'SET_USER_DATA';
export const SET_INITIAL_NOTES = 'SET_INITIAL_NOTES'; export const SET_INITIAL_NOTES = 'SET_INITIAL_NOTES';
export const SET_LAST_FETCHED_AT = 'SET_LAST_FETCHED_AT'; export const SET_LAST_FETCHED_AT = 'SET_LAST_FETCHED_AT';
......
...@@ -66,8 +66,8 @@ export default { ...@@ -66,8 +66,8 @@ export default {
Object.assign(state, { notesData: data }); Object.assign(state, { notesData: data });
}, },
[types.SET_ISSUE_DATA](state, data) { [types.SET_NOTEABLE_DATA](state, data) {
Object.assign(state, { issueData: data }); Object.assign(state, { noteableData: data });
}, },
[types.SET_USER_DATA](state, data) { [types.SET_USER_DATA](state, data) {
......
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
quick_actions_docs_path: help_page_path('user/project/quick_actions'), quick_actions_docs_path: help_page_path('user/project/quick_actions'),
notes_path: notes_url, notes_path: notes_url,
last_fetched_at: Time.now.to_i, last_fetched_at: Time.now.to_i,
issue_data: serialize_issuable(@issue), noteable_data: serialize_issuable(@issue),
current_user_data: UserSerializer.new.represent(current_user).to_json } } current_user_data: UserSerializer.new.represent(current_user).to_json } }
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import Autosize from 'autosize'; import Autosize from 'autosize';
import store from '~/notes/stores'; import store from '~/notes/stores';
import issueCommentForm from '~/notes/components/issue_comment_form.vue'; import issueCommentForm from '~/notes/components/issue_comment_form.vue';
import { loggedOutIssueData, notesDataMock, userDataMock, issueDataMock } from '../mock_data'; import { loggedOutnoteableData, notesDataMock, userDataMock, noteableDataMock } from '../mock_data';
import { keyboardDownEvent } from '../../issue_show/helpers'; import { keyboardDownEvent } from '../../issue_show/helpers';
describe('issue_comment_form component', () => { describe('issue_comment_form component', () => {
...@@ -23,7 +23,7 @@ describe('issue_comment_form component', () => { ...@@ -23,7 +23,7 @@ describe('issue_comment_form component', () => {
describe('user is logged in', () => { describe('user is logged in', () => {
beforeEach(() => { beforeEach(() => {
store.dispatch('setUserData', userDataMock); store.dispatch('setUserData', userDataMock);
store.dispatch('setIssueData', issueDataMock); store.dispatch('setNoteableData', noteableDataMock);
store.dispatch('setNotesData', notesDataMock); store.dispatch('setNotesData', notesDataMock);
vm = mountComponent(); vm = mountComponent();
...@@ -178,7 +178,7 @@ describe('issue_comment_form component', () => { ...@@ -178,7 +178,7 @@ describe('issue_comment_form component', () => {
describe('issue is confidential', () => { describe('issue is confidential', () => {
it('shows information warning', (done) => { it('shows information warning', (done) => {
store.dispatch('setIssueData', Object.assign(issueDataMock, { confidential: true })); store.dispatch('setNoteableData', Object.assign(noteableDataMock, { confidential: true }));
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.confidential-issue-warning')).toBeDefined(); expect(vm.$el.querySelector('.confidential-issue-warning')).toBeDefined();
done(); done();
...@@ -190,7 +190,7 @@ describe('issue_comment_form component', () => { ...@@ -190,7 +190,7 @@ describe('issue_comment_form component', () => {
describe('user is not logged in', () => { describe('user is not logged in', () => {
beforeEach(() => { beforeEach(() => {
store.dispatch('setUserData', null); store.dispatch('setUserData', null);
store.dispatch('setIssueData', loggedOutIssueData); store.dispatch('setNoteableData', loggedOutnoteableData);
store.dispatch('setNotesData', notesDataMock); store.dispatch('setNotesData', notesDataMock);
vm = mountComponent(); vm = mountComponent();
......
import Vue from 'vue'; import Vue from 'vue';
import store from '~/notes/stores'; import store from '~/notes/stores';
import issueDiscussion from '~/notes/components/issue_discussion.vue'; import issueDiscussion from '~/notes/components/issue_discussion.vue';
import { issueDataMock, discussionMock, notesDataMock } from '../mock_data'; import { noteableDataMock, discussionMock, notesDataMock } from '../mock_data';
describe('issue_discussion component', () => { describe('issue_discussion component', () => {
let vm; let vm;
...@@ -9,7 +9,7 @@ describe('issue_discussion component', () => { ...@@ -9,7 +9,7 @@ describe('issue_discussion component', () => {
beforeEach(() => { beforeEach(() => {
const Component = Vue.extend(issueDiscussion); const Component = Vue.extend(issueDiscussion);
store.dispatch('setIssueData', issueDataMock); store.dispatch('setNoteableData', noteableDataMock);
store.dispatch('setNotesData', notesDataMock); store.dispatch('setNotesData', notesDataMock);
vm = new Component({ vm = new Component({
......
import Vue from 'vue'; import Vue from 'vue';
import issueNotesApp from '~/notes/components/issue_notes_app.vue'; import issueNotesApp from '~/notes/components/issue_notes_app.vue';
import service from '~/notes/services/issue_notes_service'; import service from '~/notes/services/notes_service';
import * as mockData from '../mock_data'; import * as mockData from '../mock_data';
describe('issue_note_app', () => { describe('issue_note_app', () => {
...@@ -24,7 +24,7 @@ describe('issue_note_app', () => { ...@@ -24,7 +24,7 @@ describe('issue_note_app', () => {
mountComponent = (data) => { mountComponent = (data) => {
const props = data || { const props = data || {
issueData: mockData.issueDataMock, noteableData: mockData.noteableDataMock,
notesData: mockData.notesDataMock, notesData: mockData.notesDataMock,
userData: mockData.userDataMock, userData: mockData.userDataMock,
}; };
...@@ -60,7 +60,7 @@ describe('issue_note_app', () => { ...@@ -60,7 +60,7 @@ describe('issue_note_app', () => {
}); });
it('should set issue data', () => { it('should set issue data', () => {
expect(vm.$store.state.issueData).toEqual(mockData.issueDataMock); expect(vm.$store.state.noteableData).toEqual(mockData.noteableDataMock);
}); });
it('should set user data', () => { it('should set user data', () => {
......
import Vue from 'vue'; import Vue from 'vue';
import store from '~/notes/stores'; import store from '~/notes/stores';
import awardsNote from '~/notes/components/issue_note_awards_list.vue'; import awardsNote from '~/notes/components/issue_note_awards_list.vue';
import { issueDataMock, notesDataMock } from '../mock_data'; import { noteableDataMock, notesDataMock } from '../mock_data';
describe('issue_note_awards_list component', () => { describe('issue_note_awards_list component', () => {
let vm; let vm;
...@@ -10,7 +10,7 @@ describe('issue_note_awards_list component', () => { ...@@ -10,7 +10,7 @@ describe('issue_note_awards_list component', () => {
beforeEach(() => { beforeEach(() => {
const Component = Vue.extend(awardsNote); const Component = Vue.extend(awardsNote);
store.dispatch('setIssueData', issueDataMock); store.dispatch('setNoteableData', noteableDataMock);
store.dispatch('setNotesData', notesDataMock); store.dispatch('setNotesData', notesDataMock);
awardsMock = [ awardsMock = [
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import Vue from 'vue'; import Vue from 'vue';
import store from '~/notes/stores'; import store from '~/notes/stores';
import noteBody from '~/notes/components/issue_note_body.vue'; import noteBody from '~/notes/components/issue_note_body.vue';
import { issueDataMock, notesDataMock, note } from '../mock_data'; import { noteableDataMock, notesDataMock, note } from '../mock_data';
describe('issue_note_body component', () => { describe('issue_note_body component', () => {
let vm; let vm;
...@@ -10,7 +10,7 @@ describe('issue_note_body component', () => { ...@@ -10,7 +10,7 @@ describe('issue_note_body component', () => {
beforeEach(() => { beforeEach(() => {
const Component = Vue.extend(noteBody); const Component = Vue.extend(noteBody);
store.dispatch('setIssueData', issueDataMock); store.dispatch('setNoteableData', noteableDataMock);
store.dispatch('setNotesData', notesDataMock); store.dispatch('setNotesData', notesDataMock);
vm = new Component({ vm = new Component({
......
import Vue from 'vue'; import Vue from 'vue';
import store from '~/notes/stores'; import store from '~/notes/stores';
import issueNoteForm from '~/notes/components/issue_note_form.vue'; import issueNoteForm from '~/notes/components/issue_note_form.vue';
import { issueDataMock, notesDataMock } from '../mock_data'; import { noteableDataMock, notesDataMock } from '../mock_data';
import { keyboardDownEvent } from '../../issue_show/helpers'; import { keyboardDownEvent } from '../../issue_show/helpers';
describe('issue_note_form component', () => { describe('issue_note_form component', () => {
...@@ -11,7 +11,7 @@ describe('issue_note_form component', () => { ...@@ -11,7 +11,7 @@ describe('issue_note_form component', () => {
beforeEach(() => { beforeEach(() => {
const Component = Vue.extend(issueNoteForm); const Component = Vue.extend(issueNoteForm);
store.dispatch('setIssueData', issueDataMock); store.dispatch('setNoteableData', noteableDataMock);
store.dispatch('setNotesData', notesDataMock); store.dispatch('setNotesData', notesDataMock);
props = { props = {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import Vue from 'vue'; import Vue from 'vue';
import store from '~/notes/stores'; import store from '~/notes/stores';
import issueNote from '~/notes/components/issue_note.vue'; import issueNote from '~/notes/components/issue_note.vue';
import { issueDataMock, notesDataMock, note } from '../mock_data'; import { noteableDataMock, notesDataMock, note } from '../mock_data';
describe('issue_note', () => { describe('issue_note', () => {
let vm; let vm;
...@@ -10,7 +10,7 @@ describe('issue_note', () => { ...@@ -10,7 +10,7 @@ describe('issue_note', () => {
beforeEach(() => { beforeEach(() => {
const Component = Vue.extend(issueNote); const Component = Vue.extend(issueNote);
store.dispatch('setIssueData', issueDataMock); store.dispatch('setNoteableData', noteableDataMock);
store.dispatch('setNotesData', notesDataMock); store.dispatch('setNotesData', notesDataMock);
vm = new Component({ vm = new Component({
......
...@@ -18,7 +18,7 @@ export const userDataMock = { ...@@ -18,7 +18,7 @@ export const userDataMock = {
username: 'root', username: 'root',
}; };
export const issueDataMock = { export const noteableDataMock = {
assignees: [], assignees: [],
author_id: 1, author_id: 1,
branch_name: null, branch_name: null,
...@@ -271,7 +271,7 @@ export const discussionMock = { ...@@ -271,7 +271,7 @@ export const discussionMock = {
individual_note: false, individual_note: false,
}; };
export const loggedOutIssueData = { export const loggedOutnoteableData = {
"id": 98, "id": 98,
"iid": 26, "iid": 26,
"author_id": 1, "author_id": 1,
......
import * as actions from '~/notes/stores/actions'; import * as actions from '~/notes/stores/actions';
import testAction from '../../helpers/vuex_action_helper'; import testAction from '../../helpers/vuex_action_helper';
import { discussionMock, notesDataMock, userDataMock, issueDataMock, individualNote } from '../mock_data'; import { discussionMock, notesDataMock, userDataMock, noteableDataMock, individualNote } from '../mock_data';
describe('Actions Notes Store', () => { describe('Actions Notes Store', () => {
describe('setNotesData', () => { describe('setNotesData', () => {
...@@ -11,10 +11,10 @@ describe('Actions Notes Store', () => { ...@@ -11,10 +11,10 @@ describe('Actions Notes Store', () => {
}); });
}); });
describe('setIssueData', () => { describe('setNoteableData', () => {
it('should set received issue data', (done) => { it('should set received issue data', (done) => {
testAction(actions.setIssueData, null, { issueData: {} }, [ testAction(actions.setNoteableData, null, { noteableData: {} }, [
{ type: 'SET_ISSUE_DATA', payload: issueDataMock }, { type: 'SET_NOTEABLE_DATA', payload: noteableDataMock },
], done); ], done);
}); });
}); });
......
import * as getters from '~/notes/stores/getters'; import * as getters from '~/notes/stores/getters';
import { notesDataMock, userDataMock, issueDataMock, individualNote } from '../mock_data'; import { notesDataMock, userDataMock, noteableDataMock, individualNote } from '../mock_data';
describe('Getters Notes Store', () => { describe('Getters Notes Store', () => {
let state; let state;
...@@ -11,7 +11,7 @@ describe('Getters Notes Store', () => { ...@@ -11,7 +11,7 @@ describe('Getters Notes Store', () => {
notesData: notesDataMock, notesData: notesDataMock,
userData: userDataMock, userData: userDataMock,
issueData: issueDataMock, noteableData: noteableDataMock,
}; };
}); });
describe('notes', () => { describe('notes', () => {
...@@ -32,9 +32,9 @@ describe('Getters Notes Store', () => { ...@@ -32,9 +32,9 @@ describe('Getters Notes Store', () => {
}); });
}); });
describe('getIssueData', () => { describe('getNoteableData', () => {
it('should return all data in `issueData`', () => { it('should return all data in `noteableData`', () => {
expect(getters.getIssueData(state)).toEqual(issueDataMock); expect(getters.getNoteableData(state)).toEqual(noteableDataMock);
}); });
}); });
......
import mutations from '~/notes/stores/mutations'; import mutations from '~/notes/stores/mutations';
import { note, discussionMock, notesDataMock, userDataMock, issueDataMock, individualNote } from '../mock_data'; import { note, discussionMock, notesDataMock, userDataMock, noteableDataMock, individualNote } from '../mock_data';
describe('Mutation Notes Store', () => { describe('Mutation Notes Store', () => {
describe('ADD_NEW_NOTE', () => { describe('ADD_NEW_NOTE', () => {
...@@ -74,14 +74,14 @@ describe('Mutation Notes Store', () => { ...@@ -74,14 +74,14 @@ describe('Mutation Notes Store', () => {
}); });
}); });
describe('SET_ISSUE_DATA', () => { describe('SET_NOTEABLE_DATA', () => {
it('should set the issue data', () => { it('should set the issue data', () => {
const state = { const state = {
issueData: {}, noteableData: {},
}; };
mutations.SET_ISSUE_DATA(state, issueDataMock); mutations.SET_NOTEABLE_DATA(state, noteableDataMock);
expect(state.issueData).toEqual(issueDataMock); expect(state.noteableData).toEqual(noteableDataMock);
}); });
}); });
......
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