2019-09-04 21:01:54 +05:30
|
|
|
import mutations from '~/boards/stores/mutations';
|
2020-06-23 00:09:42 +05:30
|
|
|
import defaultState from '~/boards/stores/state';
|
2020-10-24 23:57:45 +05:30
|
|
|
import { mockIssue } from '../mock_data';
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
const expectNotImplemented = action => {
|
|
|
|
it('is not implemented', () => {
|
|
|
|
expect(action).toThrow(new Error('Not implemented!'));
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('Board Store Mutations', () => {
|
|
|
|
let state;
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
beforeEach(() => {
|
|
|
|
state = defaultState();
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
describe('SET_INITIAL_BOARD_DATA', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
it('Should set initial Boards data to state', () => {
|
|
|
|
const endpoints = {
|
|
|
|
boardsEndpoint: '/boards/',
|
|
|
|
recentBoardsEndpoint: '/boards/',
|
|
|
|
listsEndpoint: '/boards/lists',
|
|
|
|
bulkUpdatePath: '/boards/bulkUpdate',
|
|
|
|
boardId: 1,
|
|
|
|
fullPath: 'gitlab-org',
|
|
|
|
};
|
2020-10-24 23:57:45 +05:30
|
|
|
const boardType = 'group';
|
2020-06-23 00:09:42 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
mutations.SET_INITIAL_BOARD_DATA(state, { ...endpoints, boardType });
|
2020-06-23 00:09:42 +05:30
|
|
|
|
|
|
|
expect(state.endpoints).toEqual(endpoints);
|
2020-10-24 23:57:45 +05:30
|
|
|
expect(state.boardType).toEqual(boardType);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('SET_ACTIVE_ID', () => {
|
|
|
|
it('updates activeListId to be the value that is passed', () => {
|
|
|
|
const expectedId = 1;
|
|
|
|
|
|
|
|
mutations.SET_ACTIVE_ID(state, expectedId);
|
|
|
|
|
|
|
|
expect(state.activeId).toBe(expectedId);
|
2020-06-23 00:09:42 +05:30
|
|
|
});
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('REQUEST_ADD_LIST', () => {
|
|
|
|
expectNotImplemented(mutations.REQUEST_ADD_LIST);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_ADD_LIST_SUCCESS', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_ADD_LIST_SUCCESS);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_ADD_LIST_ERROR', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_ADD_LIST_ERROR);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('REQUEST_UPDATE_LIST', () => {
|
|
|
|
expectNotImplemented(mutations.REQUEST_UPDATE_LIST);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_UPDATE_LIST_SUCCESS', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_UPDATE_LIST_SUCCESS);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_UPDATE_LIST_ERROR', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_UPDATE_LIST_ERROR);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('REQUEST_REMOVE_LIST', () => {
|
|
|
|
expectNotImplemented(mutations.REQUEST_REMOVE_LIST);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_REMOVE_LIST_SUCCESS', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_REMOVE_LIST_SUCCESS);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_REMOVE_LIST_ERROR', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_REMOVE_LIST_ERROR);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
describe('REQUEST_ISSUES_FOR_ALL_LISTS', () => {
|
|
|
|
it('sets isLoadingIssues to true', () => {
|
|
|
|
expect(state.isLoadingIssues).toBe(false);
|
|
|
|
|
|
|
|
mutations.REQUEST_ISSUES_FOR_ALL_LISTS(state);
|
|
|
|
|
|
|
|
expect(state.isLoadingIssues).toBe(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('RECEIVE_ISSUES_FOR_ALL_LISTS_SUCCESS', () => {
|
|
|
|
it('sets isLoadingIssues to false and updates issuesByListId object', () => {
|
|
|
|
const listIssues = {
|
|
|
|
'1': [mockIssue],
|
|
|
|
};
|
|
|
|
|
|
|
|
state = {
|
|
|
|
...state,
|
|
|
|
isLoadingIssues: true,
|
|
|
|
issuesByListId: {},
|
|
|
|
};
|
|
|
|
|
|
|
|
mutations.RECEIVE_ISSUES_FOR_ALL_LISTS_SUCCESS(state, listIssues);
|
|
|
|
|
|
|
|
expect(state.isLoadingIssues).toBe(false);
|
|
|
|
expect(state.issuesByListId).toEqual(listIssues);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('REQUEST_ADD_ISSUE', () => {
|
|
|
|
expectNotImplemented(mutations.REQUEST_ADD_ISSUE);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_ADD_ISSUE_SUCCESS', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_ADD_ISSUE_SUCCESS);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_ADD_ISSUE_ERROR', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_ADD_ISSUE_ERROR);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('REQUEST_MOVE_ISSUE', () => {
|
|
|
|
expectNotImplemented(mutations.REQUEST_MOVE_ISSUE);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_MOVE_ISSUE_SUCCESS', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_MOVE_ISSUE_SUCCESS);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_MOVE_ISSUE_ERROR', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_MOVE_ISSUE_ERROR);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('REQUEST_UPDATE_ISSUE', () => {
|
|
|
|
expectNotImplemented(mutations.REQUEST_UPDATE_ISSUE);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('RECEIVE_UPDATE_ISSUE_SUCCESS', () => {
|
|
|
|
expectNotImplemented(mutations.RECEIVE_UPDATE_ISSUE_SUCCESS);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
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);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
});
|