Merge branch 'winh-issue-boards-vuex-store' into 'master'

Create empty Vuex store for issue boards

Closes #61622

See merge request gitlab-org/gitlab-ce!28229
This commit is contained in:
Phil Hughes 2019-05-20 11:05:27 +00:00
commit 712282cdcc
8 changed files with 363 additions and 0 deletions

View File

@ -0,0 +1,65 @@
const notImplemented = () => {
throw new Error('Not implemented!');
};
export default {
setEndpoints: () => {
notImplemented();
},
fetchLists: () => {
notImplemented();
},
generateDefaultLists: () => {
notImplemented();
},
createList: () => {
notImplemented();
},
updateList: () => {
notImplemented();
},
deleteList: () => {
notImplemented();
},
fetchIssuesForList: () => {
notImplemented();
},
moveIssue: () => {
notImplemented();
},
createNewIssue: () => {
notImplemented();
},
fetchBacklog: () => {
notImplemented();
},
bulkUpdateIssues: () => {
notImplemented();
},
fetchIssue: () => {
notImplemented();
},
toggleIssueSubscription: () => {
notImplemented();
},
showPage: () => {
notImplemented();
},
toggleEmptyState: () => {
notImplemented();
},
};

View File

@ -0,0 +1,14 @@
import Vue from 'vue';
import Vuex from 'vuex';
import state from 'ee_else_ce/boards/stores/state';
import actions from 'ee_else_ce/boards/stores/actions';
import mutations from 'ee_else_ce/boards/stores/mutations';
Vue.use(Vuex);
export default () =>
new Vuex.Store({
state,
actions,
mutations,
});

View File

@ -0,0 +1,21 @@
export const SET_ENDPOINTS = 'SET_ENDPOINTS';
export const REQUEST_ADD_LIST = 'REQUEST_ADD_LIST';
export const RECEIVE_ADD_LIST_SUCCESS = 'RECEIVE_ADD_LIST_SUCCESS';
export const RECEIVE_ADD_LIST_ERROR = 'RECEIVE_ADD_LIST_ERROR';
export const REQUEST_UPDATE_LIST = 'REQUEST_UPDATE_LIST';
export const RECEIVE_UPDATE_LIST_SUCCESS = 'RECEIVE_UPDATE_LIST_SUCCESS';
export const RECEIVE_UPDATE_LIST_ERROR = 'RECEIVE_UPDATE_LIST_ERROR';
export const REQUEST_REMOVE_LIST = 'REQUEST_REMOVE_LIST';
export const RECEIVE_REMOVE_LIST_SUCCESS = 'RECEIVE_REMOVE_LIST_SUCCESS';
export const RECEIVE_REMOVE_LIST_ERROR = 'RECEIVE_REMOVE_LIST_ERROR';
export const REQUEST_ADD_ISSUE = 'REQUEST_ADD_ISSUE';
export const RECEIVE_ADD_ISSUE_SUCCESS = 'RECEIVE_ADD_ISSUE_SUCCESS';
export const RECEIVE_ADD_ISSUE_ERROR = 'RECEIVE_ADD_ISSUE_ERROR';
export const REQUEST_MOVE_ISSUE = 'REQUEST_MOVE_ISSUE';
export const RECEIVE_MOVE_ISSUE_SUCCESS = 'RECEIVE_MOVE_ISSUE_SUCCESS';
export const RECEIVE_MOVE_ISSUE_ERROR = 'RECEIVE_MOVE_ISSUE_ERROR';
export const REQUEST_UPDATE_ISSUE = 'REQUEST_UPDATE_ISSUE';
export const RECEIVE_UPDATE_ISSUE_SUCCESS = 'RECEIVE_UPDATE_ISSUE_SUCCESS';
export const RECEIVE_UPDATE_ISSUE_ERROR = 'RECEIVE_UPDATE_ISSUE_ERROR';
export const SET_CURRENT_PAGE = 'SET_CURRENT_PAGE';
export const TOGGLE_EMPTY_STATE = 'TOGGLE_EMPTY_STATE';

View File

@ -0,0 +1,91 @@
import * as mutationTypes from './mutation_types';
const notImplemented = () => {
throw new Error('Not implemented!');
};
export default {
[mutationTypes.SET_ENDPOINTS]: () => {
notImplemented();
},
[mutationTypes.REQUEST_ADD_LIST]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_ADD_LIST_SUCCESS]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_ADD_LIST_ERROR]: () => {
notImplemented();
},
[mutationTypes.REQUEST_UPDATE_LIST]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_UPDATE_LIST_SUCCESS]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_UPDATE_LIST_ERROR]: () => {
notImplemented();
},
[mutationTypes.REQUEST_REMOVE_LIST]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_REMOVE_LIST_SUCCESS]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_REMOVE_LIST_ERROR]: () => {
notImplemented();
},
[mutationTypes.REQUEST_ADD_ISSUE]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_ADD_ISSUE_SUCCESS]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_ADD_ISSUE_ERROR]: () => {
notImplemented();
},
[mutationTypes.REQUEST_MOVE_ISSUE]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_MOVE_ISSUE_SUCCESS]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_MOVE_ISSUE_ERROR]: () => {
notImplemented();
},
[mutationTypes.REQUEST_UPDATE_ISSUE]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_UPDATE_ISSUE_SUCCESS]: () => {
notImplemented();
},
[mutationTypes.RECEIVE_UPDATE_ISSUE_ERROR]: () => {
notImplemented();
},
[mutationTypes.SET_CURRENT_PAGE]: () => {
notImplemented();
},
[mutationTypes.TOGGLE_EMPTY_STATE]: () => {
notImplemented();
},
};

View File

@ -0,0 +1,3 @@
export default () => ({
// ...
});

View File

@ -0,0 +1,67 @@
import actions from '~/boards/stores/actions';
const expectNotImplemented = action => {
it('is not implemented', () => {
expect(action).toThrow(new Error('Not implemented!'));
});
};
describe('setEndpoints', () => {
expectNotImplemented(actions.setEndpoints);
});
describe('fetchLists', () => {
expectNotImplemented(actions.fetchLists);
});
describe('generateDefaultLists', () => {
expectNotImplemented(actions.generateDefaultLists);
});
describe('createList', () => {
expectNotImplemented(actions.createList);
});
describe('updateList', () => {
expectNotImplemented(actions.updateList);
});
describe('deleteList', () => {
expectNotImplemented(actions.deleteList);
});
describe('fetchIssuesForList', () => {
expectNotImplemented(actions.fetchIssuesForList);
});
describe('moveIssue', () => {
expectNotImplemented(actions.moveIssue);
});
describe('createNewIssue', () => {
expectNotImplemented(actions.createNewIssue);
});
describe('fetchBacklog', () => {
expectNotImplemented(actions.fetchBacklog);
});
describe('bulkUpdateIssues', () => {
expectNotImplemented(actions.bulkUpdateIssues);
});
describe('fetchIssue', () => {
expectNotImplemented(actions.fetchIssue);
});
describe('toggleIssueSubscription', () => {
expectNotImplemented(actions.toggleIssueSubscription);
});
describe('showPage', () => {
expectNotImplemented(actions.showPage);
});
describe('toggleEmptyState', () => {
expectNotImplemented(actions.toggleEmptyState);
});

View File

@ -0,0 +1,91 @@
import mutations from '~/boards/stores/mutations';
const expectNotImplemented = action => {
it('is not implemented', () => {
expect(action).toThrow(new Error('Not implemented!'));
});
};
describe('SET_ENDPOINTS', () => {
expectNotImplemented(mutations.SET_ENDPOINTS);
});
describe('REQUEST_ADD_LIST', () => {
expectNotImplemented(mutations.REQUEST_ADD_LIST);
});
describe('RECEIVE_ADD_LIST_SUCCESS', () => {
expectNotImplemented(mutations.RECEIVE_ADD_LIST_SUCCESS);
});
describe('RECEIVE_ADD_LIST_ERROR', () => {
expectNotImplemented(mutations.RECEIVE_ADD_LIST_ERROR);
});
describe('REQUEST_UPDATE_LIST', () => {
expectNotImplemented(mutations.REQUEST_UPDATE_LIST);
});
describe('RECEIVE_UPDATE_LIST_SUCCESS', () => {
expectNotImplemented(mutations.RECEIVE_UPDATE_LIST_SUCCESS);
});
describe('RECEIVE_UPDATE_LIST_ERROR', () => {
expectNotImplemented(mutations.RECEIVE_UPDATE_LIST_ERROR);
});
describe('REQUEST_REMOVE_LIST', () => {
expectNotImplemented(mutations.REQUEST_REMOVE_LIST);
});
describe('RECEIVE_REMOVE_LIST_SUCCESS', () => {
expectNotImplemented(mutations.RECEIVE_REMOVE_LIST_SUCCESS);
});
describe('RECEIVE_REMOVE_LIST_ERROR', () => {
expectNotImplemented(mutations.RECEIVE_REMOVE_LIST_ERROR);
});
describe('REQUEST_ADD_ISSUE', () => {
expectNotImplemented(mutations.REQUEST_ADD_ISSUE);
});
describe('RECEIVE_ADD_ISSUE_SUCCESS', () => {
expectNotImplemented(mutations.RECEIVE_ADD_ISSUE_SUCCESS);
});
describe('RECEIVE_ADD_ISSUE_ERROR', () => {
expectNotImplemented(mutations.RECEIVE_ADD_ISSUE_ERROR);
});
describe('REQUEST_MOVE_ISSUE', () => {
expectNotImplemented(mutations.REQUEST_MOVE_ISSUE);
});
describe('RECEIVE_MOVE_ISSUE_SUCCESS', () => {
expectNotImplemented(mutations.RECEIVE_MOVE_ISSUE_SUCCESS);
});
describe('RECEIVE_MOVE_ISSUE_ERROR', () => {
expectNotImplemented(mutations.RECEIVE_MOVE_ISSUE_ERROR);
});
describe('REQUEST_UPDATE_ISSUE', () => {
expectNotImplemented(mutations.REQUEST_UPDATE_ISSUE);
});
describe('RECEIVE_UPDATE_ISSUE_SUCCESS', () => {
expectNotImplemented(mutations.RECEIVE_UPDATE_ISSUE_SUCCESS);
});
describe('RECEIVE_UPDATE_ISSUE_ERROR', () => {
expectNotImplemented(mutations.RECEIVE_UPDATE_ISSUE_ERROR);
});
describe('SET_CURRENT_PAGE', () => {
expectNotImplemented(mutations.SET_CURRENT_PAGE);
});
describe('TOGGLE_EMPTY_STATE', () => {
expectNotImplemented(mutations.TOGGLE_EMPTY_STATE);
});

View File

@ -0,0 +1,11 @@
import createState from '~/boards/stores/state';
describe('createState', () => {
it('is a function', () => {
expect(createState).toEqual(expect.any(Function));
});
it('returns an object', () => {
expect(createState()).toEqual(expect.any(Object));
});
});