Commit b4d60aaf authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'winh-epic-tree-remove-action-type' into 'master'

Remove ActionType constants from epic tree frontend

See merge request gitlab-org/gitlab!17971
parents a40fa70a 3da4294f
...@@ -8,11 +8,10 @@ import { sprintf, s__ } from '~/locale'; ...@@ -8,11 +8,10 @@ import { sprintf, s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import DroplabDropdownButton from '~/vue_shared/components/droplab_dropdown_button.vue'; import DroplabDropdownButton from '~/vue_shared/components/droplab_dropdown_button.vue';
import { EpicDropdownActions, ActionType } from '../constants'; import { EpicDropdownActions } from '../constants';
export default { export default {
EpicDropdownActions, EpicDropdownActions,
ActionType,
components: { components: {
Icon, Icon,
GlButton, GlButton,
...@@ -33,10 +32,10 @@ export default { ...@@ -33,10 +32,10 @@ export default {
}, },
methods: { methods: {
...mapActions(['toggleAddItemForm', 'toggleCreateEpicForm']), ...mapActions(['toggleAddItemForm', 'toggleCreateEpicForm']),
handleActionClick({ id, actionType }) { handleActionClick({ id, issuableType }) {
if (id === 0) { if (id === 0) {
this.toggleAddItemForm({ this.toggleAddItemForm({
actionType, issuableType,
toggleState: true, toggleState: true,
}); });
} else { } else {
...@@ -80,7 +79,7 @@ export default { ...@@ -80,7 +79,7 @@ export default {
:class="headerItems[1].qaClass" :class="headerItems[1].qaClass"
class="ml-1 js-add-issues-button" class="ml-1 js-add-issues-button"
size="sm" size="sm"
@click="handleActionClick({ id: 0, actionType: 'issue' })" @click="handleActionClick({ id: 0, issuableType: 'issue' })"
>{{ __('Add an issue') }}</gl-button >{{ __('Add an issue') }}</gl-button
> >
</template> </template>
......
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import { issuableTypesMap } from 'ee/related_issues/constants';
export const ChildType = { export const ChildType = {
// eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
...@@ -17,11 +18,6 @@ export const PathIdSeparator = { ...@@ -17,11 +18,6 @@ export const PathIdSeparator = {
Issue: '#', Issue: '#',
}; };
export const ActionType = {
Epic: 'epic',
Issue: 'issue',
};
export const idProp = { export const idProp = {
Epic: 'id', Epic: 'id',
Issue: 'epicIssueId', Issue: 'epicIssueId',
...@@ -50,13 +46,13 @@ export const RemoveItemModalProps = { ...@@ -50,13 +46,13 @@ export const RemoveItemModalProps = {
export const EpicDropdownActions = [ export const EpicDropdownActions = [
{ {
id: 0, id: 0,
actionType: ActionType.Epic, issuableType: issuableTypesMap.EPIC,
title: s__('Epics|Add an epic'), title: s__('Epics|Add an epic'),
description: s__('Epics|Add an existing epic as a child epic.'), description: s__('Epics|Add an existing epic as a child epic.'),
}, },
{ {
id: 1, id: 1,
actionType: ActionType.Epic, issuableType: issuableTypesMap.EPIC,
title: s__('Epics|Create new epic'), title: s__('Epics|Create new epic'),
description: s__('Epics|Create an epic within this group and add it as a child epic.'), description: s__('Epics|Create an epic within this group and add it as a child epic.'),
}, },
......
...@@ -7,12 +7,13 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; ...@@ -7,12 +7,13 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { import {
addRelatedIssueErrorMap, addRelatedIssueErrorMap,
issuableTypesMap,
pathIndeterminateErrorMap, pathIndeterminateErrorMap,
relatedIssuesRemoveErrorMap, relatedIssuesRemoveErrorMap,
} from 'ee/related_issues/constants'; } from 'ee/related_issues/constants';
import { processQueryResponse, formatChildItem, gqClient } from '../utils/epic_utils'; import { processQueryResponse, formatChildItem, gqClient } from '../utils/epic_utils';
import { ActionType, ChildType, ChildState } from '../constants'; import { ChildType, ChildState } from '../constants';
import epicChildren from '../queries/epicChildren.query.graphql'; import epicChildren from '../queries/epicChildren.query.graphql';
import epicChildReorder from '../queries/epicChildReorder.mutation.graphql'; import epicChildReorder from '../queries/epicChildReorder.mutation.graphql';
...@@ -214,10 +215,11 @@ export const receiveRemoveItemSuccess = ({ commit }, data) => ...@@ -214,10 +215,11 @@ export const receiveRemoveItemSuccess = ({ commit }, data) =>
commit(types.RECEIVE_REMOVE_ITEM_SUCCESS, data); commit(types.RECEIVE_REMOVE_ITEM_SUCCESS, data);
export const receiveRemoveItemFailure = ({ commit }, { item, status }) => { export const receiveRemoveItemFailure = ({ commit }, { item, status }) => {
commit(types.RECEIVE_REMOVE_ITEM_FAILURE, item); commit(types.RECEIVE_REMOVE_ITEM_FAILURE, item);
const issuableType = issuableTypesMap[item.type.toUpperCase()];
flash( flash(
status === httpStatusCodes.NOT_FOUND status === httpStatusCodes.NOT_FOUND
? pathIndeterminateErrorMap[ActionType[item.type]] ? pathIndeterminateErrorMap[issuableType]
: relatedIssuesRemoveErrorMap[ActionType[item.type]], : relatedIssuesRemoveErrorMap[issuableType],
); );
}; };
export const removeItem = ({ dispatch }, { parentItem, item }) => { export const removeItem = ({ dispatch }, { parentItem, item }) => {
...@@ -256,7 +258,7 @@ export const removePendingReference = ({ commit }, data) => ...@@ -256,7 +258,7 @@ export const removePendingReference = ({ commit }, data) =>
export const setItemInputValue = ({ commit }, data) => commit(types.SET_ITEM_INPUT_VALUE, data); export const setItemInputValue = ({ commit }, data) => commit(types.SET_ITEM_INPUT_VALUE, data);
export const requestAddItem = ({ commit }) => commit(types.REQUEST_ADD_ITEM); export const requestAddItem = ({ commit }) => commit(types.REQUEST_ADD_ITEM);
export const receiveAddItemSuccess = ({ dispatch, commit, getters, state }, { rawItems }) => { export const receiveAddItemSuccess = ({ dispatch, commit, getters }, { rawItems }) => {
const items = rawItems.map(item => const items = rawItems.map(item =>
formatChildItem({ formatChildItem({
...convertObjectPropsToCamelCase(item, { deep: !getters.isEpic }), ...convertObjectPropsToCamelCase(item, { deep: !getters.isEpic }),
...@@ -279,15 +281,12 @@ export const receiveAddItemSuccess = ({ dispatch, commit, getters, state }, { ra ...@@ -279,15 +281,12 @@ export const receiveAddItemSuccess = ({ dispatch, commit, getters, state }, { ra
dispatch('setPendingReferences', []); dispatch('setPendingReferences', []);
dispatch('setItemInputValue', ''); dispatch('setItemInputValue', '');
dispatch('toggleAddItemForm', { dispatch('toggleAddItemForm', { toggleState: false });
actionType: state.actionType,
toggleState: false,
});
}; };
export const receiveAddItemFailure = ({ commit, state }, data = {}) => { export const receiveAddItemFailure = ({ commit, state }, data = {}) => {
commit(types.RECEIVE_ADD_ITEM_FAILURE); commit(types.RECEIVE_ADD_ITEM_FAILURE);
let errorMessage = addRelatedIssueErrorMap[state.actionType]; let errorMessage = addRelatedIssueErrorMap[state.issuableType];
if (data.message) { if (data.message) {
errorMessage = data.message; errorMessage = data.message;
} }
...@@ -336,10 +335,7 @@ export const receiveCreateItemSuccess = ({ state, commit, dispatch, getters }, { ...@@ -336,10 +335,7 @@ export const receiveCreateItemSuccess = ({ state, commit, dispatch, getters }, {
isSubItem: false, isSubItem: false,
}); });
dispatch('toggleCreateEpicForm', { dispatch('toggleCreateEpicForm', { toggleState: false });
actionType: state.actionType,
toggleState: false,
});
}; };
export const receiveCreateItemFailure = ({ commit }) => { export const receiveCreateItemFailure = ({ commit }) => {
commit(types.RECEIVE_CREATE_ITEM_FAILURE); commit(types.RECEIVE_CREATE_ITEM_FAILURE);
......
import { issuableTypesMap } from 'ee/related_issues/constants'; import { issuableTypesMap } from 'ee/related_issues/constants';
import { ChildType, ActionType, PathIdSeparator } from '../constants'; import { ChildType, PathIdSeparator } from '../constants';
export const autoCompleteSources = () => gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources; export const autoCompleteSources = () => gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources;
...@@ -33,22 +33,10 @@ export const itemAutoCompleteSources = (state, getters) => { ...@@ -33,22 +33,10 @@ export const itemAutoCompleteSources = (state, getters) => {
return state.autoCompleteIssues ? getters.autoCompleteSources : {}; return state.autoCompleteIssues ? getters.autoCompleteSources : {};
}; };
export const issuableType = state => {
if (state.actionType === ActionType.Epic) {
return issuableTypesMap.EPIC;
}
if (state.actionType === ActionType.Issue) {
return issuableTypesMap.ISSUE;
}
return null;
};
export const itemPathIdSeparator = (state, getters) => export const itemPathIdSeparator = (state, getters) =>
getters.isEpic ? PathIdSeparator.Epic : PathIdSeparator.Issue; getters.isEpic ? PathIdSeparator.Epic : PathIdSeparator.Issue;
export const isEpic = state => state.actionType === ActionType.Epic; export const isEpic = state => state.issuableType === issuableTypesMap.EPIC;
// prevent babel-plugin-rewire from generating an invalid default during karma tests // prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {}; export default () => {};
...@@ -120,10 +120,11 @@ export default { ...@@ -120,10 +120,11 @@ export default {
state.childrenFlags[item.reference].itemRemoveInProgress = false; state.childrenFlags[item.reference].itemRemoveInProgress = false;
}, },
[types.TOGGLE_ADD_ITEM_FORM](state, { actionType, toggleState }) { [types.TOGGLE_ADD_ITEM_FORM](state, { issuableType, toggleState }) {
if (actionType) { if (issuableType) {
state.actionType = actionType; state.issuableType = issuableType;
} }
state.showAddItemForm = toggleState; state.showAddItemForm = toggleState;
state.showCreateEpicForm = false; state.showCreateEpicForm = false;
}, },
......
...@@ -10,7 +10,7 @@ export default () => ({ ...@@ -10,7 +10,7 @@ export default () => ({
issuesCount: 0, issuesCount: 0,
// Add Item Form Data // Add Item Form Data
actionType: '', issuableType: null,
itemInputValue: '', itemInputValue: '',
pendingReferences: [], pendingReferences: [],
itemAutoCompleteSources: {}, itemAutoCompleteSources: {},
......
...@@ -3,7 +3,7 @@ import * as getters from 'ee/related_items_tree/store/getters'; ...@@ -3,7 +3,7 @@ import * as getters from 'ee/related_items_tree/store/getters';
import createDefaultState from 'ee/related_items_tree/store/state'; import createDefaultState from 'ee/related_items_tree/store/state';
import { issuableTypesMap } from 'ee/related_issues/constants'; import { issuableTypesMap } from 'ee/related_issues/constants';
import { ChildType, ActionType } from 'ee/related_items_tree/constants'; import { ChildType } from 'ee/related_items_tree/constants';
import { import {
mockEpic1, mockEpic1,
...@@ -110,12 +110,12 @@ describe('RelatedItemsTree', () => { ...@@ -110,12 +110,12 @@ describe('RelatedItemsTree', () => {
}); });
describe('itemAutoCompleteSources', () => { describe('itemAutoCompleteSources', () => {
it('returns autoCompleteSources value when `actionType` is set to `Epic` and `autoCompleteEpics` is true', () => { it('returns autoCompleteSources value when `issuableType` is set to `Epic` and `autoCompleteEpics` is true', () => {
const mockGetter = { const mockGetter = {
autoCompleteSources: 'foo', autoCompleteSources: 'foo',
isEpic: true, isEpic: true,
}; };
state.actionType = ActionType.Epic; state.issuableType = issuableTypesMap.Epic;
state.autoCompleteEpics = true; state.autoCompleteEpics = true;
expect(getters.itemAutoCompleteSources(state, mockGetter)).toBe('foo'); expect(getters.itemAutoCompleteSources(state, mockGetter)).toBe('foo');
...@@ -127,11 +127,11 @@ describe('RelatedItemsTree', () => { ...@@ -127,11 +127,11 @@ describe('RelatedItemsTree', () => {
); );
}); });
it('returns autoCompleteSources value when `actionType` is set to `Issues` and `autoCompleteIssues` is true', () => { it('returns autoCompleteSources value when `issuableType` is set to `Issue` and `autoCompleteIssues` is true', () => {
const mockGetter = { const mockGetter = {
autoCompleteSources: 'foo', autoCompleteSources: 'foo',
}; };
state.actionType = ActionType.Issue; state.issuableType = issuableTypesMap.Issue;
state.autoCompleteIssues = true; state.autoCompleteIssues = true;
expect(getters.itemAutoCompleteSources(state, mockGetter)).toBe('foo'); expect(getters.itemAutoCompleteSources(state, mockGetter)).toBe('foo');
...@@ -144,17 +144,6 @@ describe('RelatedItemsTree', () => { ...@@ -144,17 +144,6 @@ describe('RelatedItemsTree', () => {
}); });
}); });
describe('issuableType', () => {
it.each`
actionType | expectedValue
${null} | ${null}
${ActionType.Epic} | ${issuableTypesMap.EPIC}
${ActionType.Issue} | ${issuableTypesMap.ISSUE}
`('for $actionType returns $expectedValue', ({ actionType, expectedValue }) => {
expect(getters.issuableType({ actionType })).toBe(expectedValue);
});
});
describe('itemPathIdSeparator', () => { describe('itemPathIdSeparator', () => {
it('returns string containing pathIdSeparator for `Epic` when isEpic is truee', () => { it('returns string containing pathIdSeparator for `Epic` when isEpic is truee', () => {
expect(getters.itemPathIdSeparator({}, { isEpic: true })).toBe('&'); expect(getters.itemPathIdSeparator({}, { isEpic: true })).toBe('&');
...@@ -167,13 +156,16 @@ describe('RelatedItemsTree', () => { ...@@ -167,13 +156,16 @@ describe('RelatedItemsTree', () => {
describe('isEpic', () => { describe('isEpic', () => {
it.each` it.each`
actionType | expectedValue issuableType | expectedValue
${null} | ${false} ${null} | ${false}
${ActionType.Issue} | ${false} ${issuableTypesMap.ISSUE} | ${false}
${ActionType.Epic} | ${true} ${issuableTypesMap.EPIC} | ${true}
`('for actionType = $actionType is $expectedValue', ({ actionType, expectedValue }) => { `(
expect(getters.isEpic({ actionType })).toBe(expectedValue); 'for issuableType = issuableType is $expectedValue',
}); ({ issuableType, expectedValue }) => {
expect(getters.isEpic({ issuableType })).toBe(expectedValue);
},
);
}); });
}); });
}); });
......
...@@ -364,15 +364,15 @@ describe('RelatedItemsTree', () => { ...@@ -364,15 +364,15 @@ describe('RelatedItemsTree', () => {
}); });
describe(types.TOGGLE_ADD_ITEM_FORM, () => { describe(types.TOGGLE_ADD_ITEM_FORM, () => {
it('should set value of `actionType`, `showAddItemForm` as it is and `showCreateEpicForm` as false on state', () => { it('should set value of `issuableType`, `showAddItemForm` as it is and `showCreateEpicForm` as false on state', () => {
const data = { const data = {
actionType: 'Epic', issuableType: 'Epic',
toggleState: true, toggleState: true,
}; };
mutations[types.TOGGLE_ADD_ITEM_FORM](state, data); mutations[types.TOGGLE_ADD_ITEM_FORM](state, data);
expect(state.actionType).toBe(data.actionType); expect(state.issuableType).toBe(data.issuableType);
expect(state.showAddItemForm).toBe(data.toggleState); expect(state.showAddItemForm).toBe(data.toggleState);
expect(state.showCreateEpicForm).toBe(false); expect(state.showCreateEpicForm).toBe(false);
}); });
......
...@@ -4,7 +4,7 @@ import { GlLoadingIcon } from '@gitlab/ui'; ...@@ -4,7 +4,7 @@ import { GlLoadingIcon } from '@gitlab/ui';
import RelatedItemsTreeApp from 'ee/related_items_tree/components/related_items_tree_app.vue'; import RelatedItemsTreeApp from 'ee/related_items_tree/components/related_items_tree_app.vue';
import RelatedItemsTreeHeader from 'ee/related_items_tree/components/related_items_tree_header.vue'; import RelatedItemsTreeHeader from 'ee/related_items_tree/components/related_items_tree_header.vue';
import createDefaultStore from 'ee/related_items_tree/store'; import createDefaultStore from 'ee/related_items_tree/store';
import { ActionType } from 'ee/related_items_tree/constants'; import { issuableTypesMap } from 'ee/related_issues/constants';
import { mockInitialConfig, mockParentItem } from '../mock_data'; import { mockInitialConfig, mockParentItem } from '../mock_data';
...@@ -119,7 +119,7 @@ describe('RelatedItemsTreeApp', () => { ...@@ -119,7 +119,7 @@ describe('RelatedItemsTreeApp', () => {
}); });
describe('handleAddItemFormCancel', () => { describe('handleAddItemFormCancel', () => {
it('calls `toggleAddItemForm` actions with params `toggleState` as true and `actionType` as `ActionType.Epic`', () => { it('calls `toggleAddItemForm` actions with params `toggleState` as `false`', () => {
spyOn(wrapper.vm, 'toggleAddItemForm'); spyOn(wrapper.vm, 'toggleAddItemForm');
wrapper.vm.handleAddItemFormCancel(); wrapper.vm.handleAddItemFormCancel();
...@@ -145,10 +145,12 @@ describe('RelatedItemsTreeApp', () => { ...@@ -145,10 +145,12 @@ describe('RelatedItemsTreeApp', () => {
}); });
describe('handleCreateEpicFormCancel', () => { describe('handleCreateEpicFormCancel', () => {
it('calls `toggleCreateEpicForm` actions with params `toggleState` and `actionType`', () => { it('calls `toggleCreateEpicForm` actions with params `toggleState`', () => {
spyOn(wrapper.vm, 'toggleCreateEpicForm'); spyOn(wrapper.vm, 'toggleCreateEpicForm');
wrapper.vm.handleCreateEpicFormCancel(); wrapper.vm.handleCreateEpicFormCancel();
expect(wrapper.vm.toggleCreateEpicForm).toHaveBeenCalledWith({ toggleState: false });
}); });
it('calls `setItemInputValue` action with empty string', () => { it('calls `setItemInputValue` action with empty string', () => {
...@@ -208,7 +210,7 @@ describe('RelatedItemsTreeApp', () => { ...@@ -208,7 +210,7 @@ describe('RelatedItemsTreeApp', () => {
it('renders item add/create form container element', done => { it('renders item add/create form container element', done => {
wrapper.vm.$store.dispatch('toggleAddItemForm', { wrapper.vm.$store.dispatch('toggleAddItemForm', {
toggleState: true, toggleState: true,
actionType: ActionType.Epic, issuableType: issuableTypesMap.Epic,
}); });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
......
...@@ -6,7 +6,7 @@ import Icon from '~/vue_shared/components/icon.vue'; ...@@ -6,7 +6,7 @@ import Icon from '~/vue_shared/components/icon.vue';
import DroplabDropdownButton from '~/vue_shared/components/droplab_dropdown_button.vue'; import DroplabDropdownButton from '~/vue_shared/components/droplab_dropdown_button.vue';
import createDefaultStore from 'ee/related_items_tree/store'; import createDefaultStore from 'ee/related_items_tree/store';
import * as epicUtils from 'ee/related_items_tree/utils/epic_utils'; import * as epicUtils from 'ee/related_items_tree/utils/epic_utils';
import { ActionType } from 'ee/related_items_tree/constants'; import { issuableTypesMap } from 'ee/related_issues/constants';
import { mockParentItem, mockQueryResponse } from '../mock_data'; import { mockParentItem, mockQueryResponse } from '../mock_data';
...@@ -54,18 +54,18 @@ describe('RelatedItemsTree', () => { ...@@ -54,18 +54,18 @@ describe('RelatedItemsTree', () => {
describe('methods', () => { describe('methods', () => {
describe('handleActionClick', () => { describe('handleActionClick', () => {
const actionType = ActionType.Epic; const issuableType = issuableTypesMap.Epic;
it('calls `toggleAddItemForm` action when provided `id` param as value `0`', () => { it('calls `toggleAddItemForm` action when provided `id` param as value `0`', () => {
spyOn(wrapper.vm, 'toggleAddItemForm'); spyOn(wrapper.vm, 'toggleAddItemForm');
wrapper.vm.handleActionClick({ wrapper.vm.handleActionClick({
id: 0, id: 0,
actionType, issuableType,
}); });
expect(wrapper.vm.toggleAddItemForm).toHaveBeenCalledWith({ expect(wrapper.vm.toggleAddItemForm).toHaveBeenCalledWith({
actionType, issuableType,
toggleState: true, toggleState: true,
}); });
}); });
......
...@@ -5,12 +5,8 @@ import * as actions from 'ee/related_items_tree/store/actions'; ...@@ -5,12 +5,8 @@ import * as actions from 'ee/related_items_tree/store/actions';
import * as types from 'ee/related_items_tree/store/mutation_types'; import * as types from 'ee/related_items_tree/store/mutation_types';
import * as epicUtils from 'ee/related_items_tree/utils/epic_utils'; import * as epicUtils from 'ee/related_items_tree/utils/epic_utils';
import { import { ChildType, ChildState, PathIdSeparator } from 'ee/related_items_tree/constants';
ChildType, import { issuableTypesMap } from 'ee/related_issues/constants';
ChildState,
ActionType,
PathIdSeparator,
} from 'ee/related_items_tree/constants';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import testAction from 'spec/helpers/vuex_action_helper'; import testAction from 'spec/helpers/vuex_action_helper';
...@@ -806,7 +802,7 @@ describe('RelatedItemTree', () => { ...@@ -806,7 +802,7 @@ describe('RelatedItemTree', () => {
describe('receiveAddItemSuccess', () => { describe('receiveAddItemSuccess', () => {
it('should set `state.itemAddInProgress` to false and dispatches actions `setPendingReferences`, `setItemInputValue` and `toggleAddItemForm`', done => { it('should set `state.itemAddInProgress` to false and dispatches actions `setPendingReferences`, `setItemInputValue` and `toggleAddItemForm`', done => {
state.epicsBeginAtIndex = 0; state.epicsBeginAtIndex = 0;
state.actionType = ActionType.Epic; state.issuableType = issuableTypesMap.EPIC;
state.isEpic = true; state.isEpic = true;
const mockEpicsWithoutPerm = mockEpics.map(item => const mockEpicsWithoutPerm = mockEpics.map(item =>
...@@ -848,7 +844,7 @@ describe('RelatedItemTree', () => { ...@@ -848,7 +844,7 @@ describe('RelatedItemTree', () => {
}, },
{ {
type: 'toggleAddItemForm', type: 'toggleAddItemForm',
payload: { actionType: ActionType.Epic, toggleState: false }, payload: { toggleState: false },
}, },
], ],
done, done,
...@@ -881,7 +877,7 @@ describe('RelatedItemTree', () => { ...@@ -881,7 +877,7 @@ describe('RelatedItemTree', () => {
actions.receiveAddItemFailure( actions.receiveAddItemFailure(
{ {
commit: () => {}, commit: () => {},
state: { actionType: ActionType.Epic }, state: { issuableType: issuableTypesMap.EPIC },
}, },
{ {
message, message,
...@@ -906,7 +902,7 @@ describe('RelatedItemTree', () => { ...@@ -906,7 +902,7 @@ describe('RelatedItemTree', () => {
}); });
it('should dispatch `requestAddItem` and `receiveAddItemSuccess` actions on request success', done => { it('should dispatch `requestAddItem` and `receiveAddItemSuccess` actions on request success', done => {
state.actionType = ActionType.Epic; state.issuableType = issuableTypesMap.EPIC;
state.epicsEndpoint = '/foo/bar'; state.epicsEndpoint = '/foo/bar';
state.pendingReferences = ['foo']; state.pendingReferences = ['foo'];
state.isEpic = true; state.isEpic = true;
...@@ -932,7 +928,7 @@ describe('RelatedItemTree', () => { ...@@ -932,7 +928,7 @@ describe('RelatedItemTree', () => {
}); });
it('should dispatch `requestAddItem` and `receiveAddItemFailure` actions on request failure', done => { it('should dispatch `requestAddItem` and `receiveAddItemFailure` actions on request failure', done => {
state.actionType = ActionType.Epic; state.issuableType = issuableTypesMap.EPIC;
state.epicsEndpoint = '/foo/bar'; state.epicsEndpoint = '/foo/bar';
state.pendingReferences = ['foo']; state.pendingReferences = ['foo'];
...@@ -980,7 +976,7 @@ describe('RelatedItemTree', () => { ...@@ -980,7 +976,7 @@ describe('RelatedItemTree', () => {
state.parentItem = { state.parentItem = {
fullPath: createdEpic.group.fullPath, fullPath: createdEpic.group.fullPath,
}; };
state.actionType = ActionType.Epic; state.issuableType = issuableTypesMap.EPIC;
state.isEpic = true; state.isEpic = true;
testAction( testAction(
...@@ -1004,7 +1000,7 @@ describe('RelatedItemTree', () => { ...@@ -1004,7 +1000,7 @@ describe('RelatedItemTree', () => {
}, },
{ {
type: 'toggleCreateEpicForm', type: 'toggleCreateEpicForm',
payload: { actionType: ActionType.Epic, toggleState: false }, payload: { toggleState: false },
}, },
], ],
done, done,
...@@ -1033,7 +1029,7 @@ describe('RelatedItemTree', () => { ...@@ -1033,7 +1029,7 @@ describe('RelatedItemTree', () => {
actions.receiveCreateItemFailure( actions.receiveCreateItemFailure(
{ {
commit: () => {}, commit: () => {},
state: { actionType: ActionType.Epic }, state: {},
}, },
{ {
message, message,
...@@ -1052,7 +1048,7 @@ describe('RelatedItemTree', () => { ...@@ -1052,7 +1048,7 @@ describe('RelatedItemTree', () => {
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
state.parentItem = mockParentItem; state.parentItem = mockParentItem;
state.actionType = ActionType.Epic; state.issuableType = issuableTypesMap.EPIC;
}); });
afterEach(() => { afterEach(() => {
......
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