Commit b6b99e4d authored by Florie Guibert's avatar Florie Guibert

Refactor shared board action

Refactor fetchLists action
parent 0d8a22ff
import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql';
import { __ } from '~/locale'; import { __ } from '~/locale';
import updateEpicSubscriptionMutation from '~/sidebar/queries/update_epic_subscription.mutation.graphql'; import updateEpicSubscriptionMutation from '~/sidebar/queries/update_epic_subscription.mutation.graphql';
import updateEpicTitleMutation from '~/sidebar/queries/update_epic_title.mutation.graphql'; import updateEpicTitleMutation from '~/sidebar/queries/update_epic_title.mutation.graphql';
import boardBlockingIssuesQuery from './graphql/board_blocking_issues.query.graphql'; import boardBlockingIssuesQuery from './graphql/board_blocking_issues.query.graphql';
import destroyBoardListMutation from './graphql/board_list_destroy.mutation.graphql'; import destroyBoardListMutation from './graphql/board_list_destroy.mutation.graphql';
import updateBoardListMutation from './graphql/board_list_update.mutation.graphql'; import updateBoardListMutation from './graphql/board_list_update.mutation.graphql';
import issueSetSubscriptionMutation from './graphql/issue_set_subscription.mutation.graphql'; import issueSetSubscriptionMutation from './graphql/issue_set_subscription.mutation.graphql';
import issueSetTitleMutation from './graphql/issue_set_title.mutation.graphql'; import issueSetTitleMutation from './graphql/issue_set_title.mutation.graphql';
...@@ -62,6 +64,12 @@ export const NOT_FILTER = 'not['; ...@@ -62,6 +64,12 @@ export const NOT_FILTER = 'not[';
export const flashAnimationDuration = 2000; export const flashAnimationDuration = 2000;
export const listsQuery = {
[issuableTypes.issue]: {
query: boardListsQuery,
},
};
export const blockingIssuablesQueries = { export const blockingIssuablesQueries = {
[issuableTypes.issue]: { [issuableTypes.issue]: {
query: boardBlockingIssuesQuery, query: boardBlockingIssuesQuery,
......
...@@ -37,6 +37,7 @@ import { ...@@ -37,6 +37,7 @@ import {
import { __ } from '~/locale'; import { __ } from '~/locale';
import sidebarEventHub from '~/sidebar/event_hub'; import sidebarEventHub from '~/sidebar/event_hub';
import introspectionQueryResultData from '~/sidebar/fragmentTypes.json'; import introspectionQueryResultData from '~/sidebar/fragmentTypes.json';
import { fullBoardId } from './boards_util';
import boardConfigToggle from './config_toggle'; import boardConfigToggle from './config_toggle';
import mountMultipleBoardsSwitcher from './mount_multiple_boards_switcher'; import mountMultipleBoardsSwitcher from './mount_multiple_boards_switcher';
...@@ -135,6 +136,7 @@ export default () => { ...@@ -135,6 +136,7 @@ export default () => {
created() { created() {
this.setInitialBoardData({ this.setInitialBoardData({
boardId: $boardApp.dataset.boardId, boardId: $boardApp.dataset.boardId,
fullBoardId: fullBoardId($boardApp.dataset.boardId),
fullPath: $boardApp.dataset.fullPath, fullPath: $boardApp.dataset.fullPath,
boardType: this.parent, boardType: this.parent,
disabled: this.disabled, disabled: this.disabled,
......
...@@ -9,10 +9,10 @@ import { ...@@ -9,10 +9,10 @@ import {
subscriptionQueries, subscriptionQueries,
SupportedFilters, SupportedFilters,
deleteListQueries, deleteListQueries,
listsQuery,
updateListQueries, updateListQueries,
} from 'ee_else_ce/boards/constants'; } from 'ee_else_ce/boards/constants';
import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create.mutation.graphql'; import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create.mutation.graphql';
import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql';
import issueMoveListMutation from 'ee_else_ce/boards/graphql/issue_move_list.mutation.graphql'; import issueMoveListMutation from 'ee_else_ce/boards/graphql/issue_move_list.mutation.graphql';
import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import createGqClient, { fetchPolicies } from '~/lib/graphql'; import createGqClient, { fetchPolicies } from '~/lib/graphql';
...@@ -21,7 +21,6 @@ import { s__ } from '~/locale'; ...@@ -21,7 +21,6 @@ import { s__ } from '~/locale';
import { import {
formatBoardLists, formatBoardLists,
formatListIssues, formatListIssues,
fullBoardId,
formatListsPageInfo, formatListsPageInfo,
formatIssue, formatIssue,
formatIssueInput, formatIssueInput,
...@@ -86,16 +85,12 @@ export default { ...@@ -86,16 +85,12 @@ export default {
} }
}, },
fetchLists: ({ dispatch }) => { fetchLists: ({ commit, state, dispatch }) => {
dispatch('fetchIssueLists'); const { boardType, filterParams, fullPath, fullBoardId, issuableType } = state;
},
fetchIssueLists: ({ commit, state, dispatch }) => {
const { boardType, filterParams, fullPath, boardId } = state;
const variables = { const variables = {
fullPath, fullPath,
boardId: fullBoardId(boardId), boardId: fullBoardId,
filters: filterParams, filters: filterParams,
isGroup: boardType === BoardType.group, isGroup: boardType === BoardType.group,
isProject: boardType === BoardType.project, isProject: boardType === BoardType.project,
...@@ -103,7 +98,7 @@ export default { ...@@ -103,7 +98,7 @@ export default {
return gqlClient return gqlClient
.query({ .query({
query: boardListsQuery, query: listsQuery[issuableType].query,
variables, variables,
}) })
.then(({ data }) => { .then(({ data }) => {
...@@ -137,7 +132,7 @@ export default { ...@@ -137,7 +132,7 @@ export default {
{ state, commit, dispatch, getters }, { state, commit, dispatch, getters },
{ backlog, labelId, milestoneId, assigneeId, iterationId }, { backlog, labelId, milestoneId, assigneeId, iterationId },
) => { ) => {
const { boardId } = state; const { fullBoardId } = state;
const existingList = getters.getListByLabelId(labelId); const existingList = getters.getListByLabelId(labelId);
...@@ -150,7 +145,7 @@ export default { ...@@ -150,7 +145,7 @@ export default {
.mutate({ .mutate({
mutation: createBoardListMutation, mutation: createBoardListMutation,
variables: { variables: {
boardId: fullBoardId(boardId), boardId: fullBoardId,
backlog, backlog,
labelId, labelId,
milestoneId, milestoneId,
...@@ -296,11 +291,11 @@ export default { ...@@ -296,11 +291,11 @@ export default {
fetchItemsForList: ({ state, commit }, { listId, fetchNext = false }) => { fetchItemsForList: ({ state, commit }, { listId, fetchNext = false }) => {
commit(types.REQUEST_ITEMS_FOR_LIST, { listId, fetchNext }); commit(types.REQUEST_ITEMS_FOR_LIST, { listId, fetchNext });
const { fullPath, boardId, boardType, filterParams } = state; const { fullPath, fullBoardId, boardType, filterParams } = state;
const variables = { const variables = {
fullPath, fullPath,
boardId: fullBoardId(boardId), boardId: fullBoardId,
id: listId, id: listId,
filters: filterParams, filters: filterParams,
isGroup: boardType === BoardType.group, isGroup: boardType === BoardType.group,
...@@ -429,7 +424,7 @@ export default { ...@@ -429,7 +424,7 @@ export default {
try { try {
const { itemId, fromListId, toListId, moveBeforeId, moveAfterId } = moveData; const { itemId, fromListId, toListId, moveBeforeId, moveAfterId } = moveData;
const { const {
boardId, fullBoardId,
boardItems: { boardItems: {
[itemId]: { iid, referencePath }, [itemId]: { iid, referencePath },
}, },
...@@ -440,7 +435,7 @@ export default { ...@@ -440,7 +435,7 @@ export default {
variables: { variables: {
iid, iid,
projectPath: referencePath.split(/[#]/)[0], projectPath: referencePath.split(/[#]/)[0],
boardId: fullBoardId(boardId), boardId: fullBoardId,
fromListId: getIdFromGraphQLId(fromListId), fromListId: getIdFromGraphQLId(fromListId),
toListId: getIdFromGraphQLId(toListId), toListId: getIdFromGraphQLId(toListId),
moveBeforeId, moveBeforeId,
......
...@@ -40,8 +40,9 @@ export const addItemToList = ({ state, listId, itemId, moveBeforeId, moveAfterId ...@@ -40,8 +40,9 @@ export const addItemToList = ({ state, listId, itemId, moveBeforeId, moveAfterId
export default { export default {
[mutationTypes.SET_INITIAL_BOARD_DATA](state, data) { [mutationTypes.SET_INITIAL_BOARD_DATA](state, data) {
const { boardType, disabled, boardId, fullPath, boardConfig, issuableType } = data; const { boardType, disabled, boardId, fullBoardId, fullPath, boardConfig, issuableType } = data;
state.boardId = boardId; state.boardId = boardId;
state.fullBoardId = fullBoardId;
state.fullPath = fullPath; state.fullPath = fullPath;
state.boardType = boardType; state.boardType = boardType;
state.disabled = disabled; state.disabled = disabled;
......
...@@ -4,8 +4,10 @@ import updateBoardListMutation from '~/boards/graphql/board_list_update.mutation ...@@ -4,8 +4,10 @@ import updateBoardListMutation from '~/boards/graphql/board_list_update.mutation
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import boardListsQuery from './graphql/board_lists.query.graphql';
import destroyEpicBoardListMutation from './graphql/epic_board_list_destroy.mutation.graphql'; import destroyEpicBoardListMutation from './graphql/epic_board_list_destroy.mutation.graphql';
import updateEpicBoardListMutation from './graphql/epic_board_list_update.mutation.graphql'; import updateEpicBoardListMutation from './graphql/epic_board_list_update.mutation.graphql';
import epicBoardListsQuery from './graphql/epic_board_lists.query.graphql';
export const DRAGGABLE_TAG = 'div'; export const DRAGGABLE_TAG = 'div';
...@@ -61,6 +63,18 @@ export const ErrorMessages = { ...@@ -61,6 +63,18 @@ export const ErrorMessages = {
), ),
}; };
/* eslint-disable import/export */
export * from '~/boards/constants';
export const listsQuery = {
[issuableTypes.issue]: {
query: boardListsQuery,
},
[issuableTypes.epic]: {
query: epicBoardListsQuery,
},
};
export const updateListQueries = { export const updateListQueries = {
[issuableTypes.issue]: { [issuableTypes.issue]: {
mutation: updateBoardListMutation, mutation: updateBoardListMutation,
...@@ -79,22 +93,7 @@ export const deleteListQueries = { ...@@ -79,22 +93,7 @@ export const deleteListQueries = {
}, },
}; };
// re-export some FOSS constants so that lint does not yell
// https://gitlab.com/gitlab-org/gitlab/-/issues/329164
export {
BoardType,
ListType,
inactiveId,
flashAnimationDuration,
ISSUABLE,
titleQueries,
subscriptionQueries,
SupportedFilters,
} from '~/boards/constants';
export default { export default {
deleteListQueries,
updateListQueries,
DRAGGABLE_TAG, DRAGGABLE_TAG,
EpicFilterType, EpicFilterType,
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
query ListEpics($fullPath: ID!, $boardId: BoardsEpicBoardID!) { query ListEpics($fullPath: ID!, $boardId: BoardsEpicBoardID!) {
group(fullPath: $fullPath) { group(fullPath: $fullPath) {
epicBoard(id: $boardId) { board: epicBoard(id: $boardId) {
lists { lists {
nodes { nodes {
...EpicBoardListFragment ...EpicBoardListFragment
......
import { import {
formatBoardLists,
formatListIssues, formatListIssues,
formatListsPageInfo, formatListsPageInfo,
fullBoardId, fullBoardId,
...@@ -36,7 +35,6 @@ import { ...@@ -36,7 +35,6 @@ import {
} from '../constants'; } from '../constants';
import epicQuery from '../graphql/epic.query.graphql'; import epicQuery from '../graphql/epic.query.graphql';
import createEpicBoardListMutation from '../graphql/epic_board_list_create.mutation.graphql'; import createEpicBoardListMutation from '../graphql/epic_board_list_create.mutation.graphql';
import epicBoardListsQuery from '../graphql/epic_board_lists.query.graphql';
import epicMoveListMutation from '../graphql/epic_move_list.mutation.graphql'; import epicMoveListMutation from '../graphql/epic_move_list.mutation.graphql';
import epicsSwimlanesQuery from '../graphql/epics_swimlanes.query.graphql'; import epicsSwimlanesQuery from '../graphql/epics_swimlanes.query.graphql';
import groupBoardAssigneesQuery from '../graphql/group_board_assignees.query.graphql'; import groupBoardAssigneesQuery from '../graphql/group_board_assignees.query.graphql';
...@@ -164,7 +162,7 @@ export default { ...@@ -164,7 +162,7 @@ export default {
dispatch('resetEpics'); dispatch('resetEpics');
dispatch('resetIssues'); dispatch('resetIssues');
dispatch('fetchEpicsSwimlanes'); dispatch('fetchEpicsSwimlanes');
dispatch('fetchIssueLists'); dispatch('fetchLists');
} else if (gon.features.graphqlBoardLists || getters.isEpicBoard) { } else if (gon.features.graphqlBoardLists || getters.isEpicBoard) {
dispatch('fetchLists'); dispatch('fetchLists');
dispatch('resetIssues'); dispatch('resetIssues');
...@@ -354,7 +352,7 @@ export default { ...@@ -354,7 +352,7 @@ export default {
}), }),
); );
dispatch('fetchEpicsSwimlanes'); dispatch('fetchEpicsSwimlanes');
dispatch('fetchIssueLists'); dispatch('fetchLists');
} else if (!gon.features.graphqlBoardLists) { } else if (!gon.features.graphqlBoardLists) {
historyPushState(removeParams(['group_by']), window.location.href, true); historyPushState(removeParams(['group_by']), window.location.href, true);
boardsStore.create(); boardsStore.create();
...@@ -541,35 +539,6 @@ export default { ...@@ -541,35 +539,6 @@ export default {
); );
}, },
fetchLists: ({ getters, dispatch }) => {
if (!getters.isEpicBoard) {
dispatch('fetchIssueLists');
} else {
dispatch('fetchEpicLists');
}
},
fetchEpicLists: ({ commit, state }) => {
const { filterParams, fullPath, boardId } = state;
const variables = {
fullPath,
boardId: fullEpicBoardId(boardId),
filters: filterParams,
};
return gqlClient
.query({
query: epicBoardListsQuery,
variables,
})
.then(({ data }) => {
const { lists } = data.group?.epicBoard;
commit(types.RECEIVE_BOARD_LISTS_SUCCESS, formatBoardLists(lists));
})
.catch(() => commit(types.RECEIVE_BOARD_LISTS_FAILURE));
},
fetchMilestones({ state, commit }, searchTerm) { fetchMilestones({ state, commit }, searchTerm) {
commit(types.RECEIVE_MILESTONES_REQUEST); commit(types.RECEIVE_MILESTONES_REQUEST);
......
...@@ -6,7 +6,7 @@ import Vue from 'vue'; ...@@ -6,7 +6,7 @@ import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { transformBoardConfig } from 'ee_component/boards/boards_util'; import { fullEpicBoardId, transformBoardConfig } from 'ee_component/boards/boards_util';
import BoardSidebar from 'ee_component/boards/components/board_sidebar'; import BoardSidebar from 'ee_component/boards/components/board_sidebar';
import toggleLabels from 'ee_component/boards/toggle_labels'; import toggleLabels from 'ee_component/boards/toggle_labels';
...@@ -99,6 +99,7 @@ export default () => { ...@@ -99,6 +99,7 @@ export default () => {
created() { created() {
this.setInitialBoardData({ this.setInitialBoardData({
boardId: $boardApp.dataset.boardId, boardId: $boardApp.dataset.boardId,
fullBoardId: fullEpicBoardId($boardApp.dataset.boardId),
fullPath: $boardApp.dataset.fullPath, fullPath: $boardApp.dataset.fullPath,
boardType: this.parent, boardType: this.parent,
disabled: this.disabled, disabled: this.disabled,
......
...@@ -10,8 +10,7 @@ import mutations from 'ee/boards/stores/mutations'; ...@@ -10,8 +10,7 @@ import mutations from 'ee/boards/stores/mutations';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { mockMoveIssueParams, mockMoveData, mockMoveState } from 'jest/boards/mock_data'; import { mockMoveIssueParams, mockMoveData, mockMoveState } from 'jest/boards/mock_data';
import { formatBoardLists, formatListIssues } from '~/boards/boards_util'; import { formatListIssues } from '~/boards/boards_util';
import { issuableTypes } from '~/boards/constants';
import listsIssuesQuery from '~/boards/graphql/lists_issues.query.graphql'; import listsIssuesQuery from '~/boards/graphql/lists_issues.query.graphql';
import * as typesCE from '~/boards/stores/mutation_types'; import * as typesCE from '~/boards/stores/mutation_types';
import * as commonUtils from '~/lib/utils/common_utils'; import * as commonUtils from '~/lib/utils/common_utils';
...@@ -137,7 +136,7 @@ describe('performSearch', () => { ...@@ -137,7 +136,7 @@ describe('performSearch', () => {
}); });
}); });
it('should dispatch setFilters, resetEpics, fetchEpicsSwimlanes, fetchIssueLists and resetIssues action when isSwimlanesOn', async () => { it('should dispatch setFilters, resetEpics, fetchEpicsSwimlanes, fetchLists and resetIssues action when isSwimlanesOn', async () => {
const getters = { isSwimlanesOn: true }; const getters = { isSwimlanesOn: true };
await testAction({ await testAction({
action: actions.performSearch, action: actions.performSearch,
...@@ -147,78 +146,7 @@ describe('performSearch', () => { ...@@ -147,78 +146,7 @@ describe('performSearch', () => {
{ type: 'resetEpics' }, { type: 'resetEpics' },
{ type: 'resetIssues' }, { type: 'resetIssues' },
{ type: 'fetchEpicsSwimlanes' }, { type: 'fetchEpicsSwimlanes' },
{ type: 'fetchIssueLists' }, { type: 'fetchLists' },
],
});
});
});
describe('fetchLists', () => {
it('should dispatch fetchIssueLists action when isEpicBoard is false', async () => {
const getters = { isEpicBoard: false };
await testAction({
action: actions.fetchLists,
state: { issuableType: issuableTypes.issue, ...getters },
expectedActions: [{ type: 'fetchIssueLists' }],
});
});
it('should dispatch fetchEpicLists action when isEpicBoard is true', async () => {
const getters = { isEpicBoard: true };
await testAction({
action: actions.fetchLists,
state: { issuableType: issuableTypes.epic, ...getters },
expectedActions: [{ type: 'fetchEpicLists' }],
});
});
});
describe('fetchEpicLists', () => {
const state = {
fullPath: 'gitlab-org',
boardId: '1',
filterParams: {},
};
const queryResponse = {
data: {
group: {
epicBoard: {
lists: {
nodes: mockLists,
},
},
},
},
};
const formattedLists = formatBoardLists(queryResponse.data.group.epicBoard.lists);
it('should commit mutations RECEIVE_BOARD_LISTS_SUCCESS on success', async () => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
await testAction({
action: actions.fetchEpicLists,
state,
expectedMutations: [
{
type: types.RECEIVE_BOARD_LISTS_SUCCESS,
payload: formattedLists,
},
],
});
});
it('should commit mutations RECEIVE_BOARD_LISTS_FAILURE on failure', async () => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject());
await testAction({
action: actions.fetchEpicLists,
state,
expectedMutations: [
{
type: types.RECEIVE_BOARD_LISTS_FAILURE,
},
], ],
}); });
}); });
...@@ -595,7 +523,7 @@ describe('toggleEpicSwimlanes', () => { ...@@ -595,7 +523,7 @@ describe('toggleEpicSwimlanes', () => {
); );
}); });
it('should dispatch fetchEpicsSwimlanes and fetchIssueLists actions when isShowingEpicsSwimlanes is true', () => { it('should dispatch fetchEpicsSwimlanes and fetchLists actions when isShowingEpicsSwimlanes is true', () => {
global.jsdom.reconfigure({ global.jsdom.reconfigure({
url: `${TEST_HOST}/groups/gitlab-org/-/boards/1`, url: `${TEST_HOST}/groups/gitlab-org/-/boards/1`,
}); });
...@@ -613,7 +541,7 @@ describe('toggleEpicSwimlanes', () => { ...@@ -613,7 +541,7 @@ describe('toggleEpicSwimlanes', () => {
null, null,
state, state,
[{ type: types.TOGGLE_EPICS_SWIMLANES }], [{ type: types.TOGGLE_EPICS_SWIMLANES }],
[{ type: 'fetchEpicsSwimlanes' }, { type: 'fetchIssueLists' }], [{ type: 'fetchEpicsSwimlanes' }, { type: 'fetchLists' }],
() => { () => {
expect(commonUtils.historyPushState).toHaveBeenCalledWith( expect(commonUtils.historyPushState).toHaveBeenCalledWith(
mergeUrlParams({ group_by: GroupByParamType.epic }, window.location.href), mergeUrlParams({ group_by: GroupByParamType.epic }, window.location.href),
......
...@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/browser'; ...@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/browser';
import issueMoveListMutation from 'ee_else_ce/boards/graphql/issue_move_list.mutation.graphql'; import issueMoveListMutation from 'ee_else_ce/boards/graphql/issue_move_list.mutation.graphql';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { import {
fullBoardId,
formatListIssues, formatListIssues,
formatBoardLists, formatBoardLists,
formatIssueInput, formatIssueInput,
...@@ -132,20 +131,12 @@ describe('setActiveId', () => { ...@@ -132,20 +131,12 @@ describe('setActiveId', () => {
}); });
describe('fetchLists', () => { describe('fetchLists', () => {
it('should dispatch fetchIssueLists action', () => {
testAction({
action: actions.fetchLists,
expectedActions: [{ type: 'fetchIssueLists' }],
});
});
});
describe('fetchIssueLists', () => {
const state = { const state = {
fullPath: 'gitlab-org', fullPath: 'gitlab-org',
boardId: '1', fullBoardId: 'gid://gitlab/Board/1',
filterParams: {}, filterParams: {},
boardType: 'group', boardType: 'group',
issuableType: 'issue',
}; };
let queryResponse = { let queryResponse = {
...@@ -167,7 +158,7 @@ describe('fetchIssueLists', () => { ...@@ -167,7 +158,7 @@ describe('fetchIssueLists', () => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction( testAction(
actions.fetchIssueLists, actions.fetchLists,
{}, {},
state, state,
[ [
...@@ -185,7 +176,7 @@ describe('fetchIssueLists', () => { ...@@ -185,7 +176,7 @@ describe('fetchIssueLists', () => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject()); jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject());
testAction( testAction(
actions.fetchIssueLists, actions.fetchLists,
{}, {},
state, state,
[ [
...@@ -214,7 +205,7 @@ describe('fetchIssueLists', () => { ...@@ -214,7 +205,7 @@ describe('fetchIssueLists', () => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction( testAction(
actions.fetchIssueLists, actions.fetchLists,
{}, {},
state, state,
[ [
...@@ -248,7 +239,7 @@ describe('createIssueList', () => { ...@@ -248,7 +239,7 @@ describe('createIssueList', () => {
beforeEach(() => { beforeEach(() => {
state = { state = {
fullPath: 'gitlab-org', fullPath: 'gitlab-org',
boardId: '1', fullBoardId: 'gid://gitlab/Board/1',
boardType: 'group', boardType: 'group',
disabled: false, disabled: false,
boardLists: [{ type: 'closed' }], boardLists: [{ type: 'closed' }],
...@@ -378,7 +369,7 @@ describe('moveList', () => { ...@@ -378,7 +369,7 @@ describe('moveList', () => {
const state = { const state = {
fullPath: 'gitlab-org', fullPath: 'gitlab-org',
boardId: '1', fullBoardId: 'gid://gitlab/Board/1',
boardType: 'group', boardType: 'group',
disabled: false, disabled: false,
boardLists: initialBoardListsState, boardLists: initialBoardListsState,
...@@ -421,7 +412,7 @@ describe('moveList', () => { ...@@ -421,7 +412,7 @@ describe('moveList', () => {
const state = { const state = {
fullPath: 'gitlab-org', fullPath: 'gitlab-org',
boardId: '1', fullBoardId: 'gid://gitlab/Board/1',
boardType: 'group', boardType: 'group',
disabled: false, disabled: false,
boardLists: initialBoardListsState, boardLists: initialBoardListsState,
...@@ -455,7 +446,7 @@ describe('updateList', () => { ...@@ -455,7 +446,7 @@ describe('updateList', () => {
const state = { const state = {
fullPath: 'gitlab-org', fullPath: 'gitlab-org',
boardId: '1', fullBoardId: 'gid://gitlab/Board/1',
boardType: 'group', boardType: 'group',
disabled: false, disabled: false,
boardLists: [{ type: 'closed' }], boardLists: [{ type: 'closed' }],
...@@ -573,7 +564,7 @@ describe('fetchItemsForList', () => { ...@@ -573,7 +564,7 @@ describe('fetchItemsForList', () => {
const state = { const state = {
fullPath: 'gitlab-org', fullPath: 'gitlab-org',
boardId: '1', fullBoardId: 'gid://gitlab/Board/1',
filterParams: {}, filterParams: {},
boardType: 'group', boardType: 'group',
}; };
...@@ -960,7 +951,7 @@ describe('updateIssueOrder', () => { ...@@ -960,7 +951,7 @@ describe('updateIssueOrder', () => {
const state = { const state = {
boardItems: issues, boardItems: issues,
boardId: 'gid://gitlab/Board/1', fullBoardId: 'gid://gitlab/Board/1',
}; };
const moveData = { const moveData = {
...@@ -974,7 +965,7 @@ describe('updateIssueOrder', () => { ...@@ -974,7 +965,7 @@ describe('updateIssueOrder', () => {
mutation: issueMoveListMutation, mutation: issueMoveListMutation,
variables: { variables: {
projectPath: getProjectPath(mockIssue.referencePath), projectPath: getProjectPath(mockIssue.referencePath),
boardId: fullBoardId(state.boardId), boardId: state.fullBoardId,
iid: mockIssue.iid, iid: mockIssue.iid,
fromListId: 1, fromListId: 1,
toListId: 2, toListId: 2,
......
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