Commit fbe226dc authored by Florie Guibert's avatar Florie Guibert

Epic Boards - Drag & Drop epic between lists

Review feedback
parent 798e516f
...@@ -356,7 +356,7 @@ export default { ...@@ -356,7 +356,7 @@ export default {
}) })
.then(({ data }) => { .then(({ data }) => {
if (data?.issueMoveList?.errors.length) { if (data?.issueMoveList?.errors.length) {
commit(types.MOVE_ISSUE_FAILURE, { originalIssue, fromListId, toListId, originalIndex }); throw new Error();
} else { } else {
const issue = data.issueMoveList?.issue; const issue = data.issueMoveList?.issue;
commit(types.MOVE_ISSUE_SUCCESS, { issue }); commit(types.MOVE_ISSUE_SUCCESS, { issue });
......
...@@ -528,7 +528,7 @@ export default { ...@@ -528,7 +528,7 @@ export default {
}) })
.then(({ data }) => { .then(({ data }) => {
if (data?.issueMoveList?.errors.length) { if (data?.issueMoveList?.errors.length) {
commit(types.MOVE_ISSUE_FAILURE, { originalIssue, fromListId, toListId, originalIndex }); throw new Error();
} else { } else {
const issue = data.issueMoveList?.issue; const issue = data.issueMoveList?.issue;
commit(types.MOVE_ISSUE_SUCCESS, { issue }); commit(types.MOVE_ISSUE_SUCCESS, { issue });
...@@ -565,7 +565,7 @@ export default { ...@@ -565,7 +565,7 @@ export default {
}) })
.then(({ data }) => { .then(({ data }) => {
if (data?.epicMoveList?.errors.length) { if (data?.epicMoveList?.errors.length) {
commit(types.MOVE_EPIC_FAILURE, { originalEpic, fromListId, toListId, originalIndex }); throw new Error();
} }
}) })
.catch(() => .catch(() =>
......
...@@ -1002,7 +1002,7 @@ describe('moveEpic', () => { ...@@ -1002,7 +1002,7 @@ describe('moveEpic', () => {
issuableType: 'epic', issuableType: 'epic',
}; };
it('should commit MOVE_EPIC mutation mutation when successful', (done) => { it('should commit MOVE_EPIC mutation mutation when successful', async () => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
epicMoveList: { epicMoveList: {
...@@ -1011,15 +1011,15 @@ describe('moveEpic', () => { ...@@ -1011,15 +1011,15 @@ describe('moveEpic', () => {
}, },
}); });
testAction( await testAction({
actions.moveEpic, action: actions.moveEpic,
{ payload: {
itemId: '41', itemId: '41',
fromListId: 'gid://gitlab/List/1', fromListId: 'gid://gitlab/List/1',
toListId: 'gid://gitlab/List/2', toListId: 'gid://gitlab/List/2',
}, },
state, state,
[ expectedMutations: [
{ {
type: types.MOVE_EPIC, type: types.MOVE_EPIC,
payload: { payload: {
...@@ -1029,12 +1029,10 @@ describe('moveEpic', () => { ...@@ -1029,12 +1029,10 @@ describe('moveEpic', () => {
}, },
}, },
], ],
[], });
done,
);
}); });
it('should commit MOVE_EPIC mutation and MOVE_EPIC_FAILURE mutation when unsuccessful', (done) => { it('should commit MOVE_EPIC mutation and MOVE_EPIC_FAILURE mutation when unsuccessful', async () => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
epicMoveList: { epicMoveList: {
...@@ -1043,15 +1041,15 @@ describe('moveEpic', () => { ...@@ -1043,15 +1041,15 @@ describe('moveEpic', () => {
}, },
}); });
testAction( await testAction({
actions.moveEpic, action: actions.moveEpic,
{ payload: {
itemId: '41', itemId: '41',
fromListId: 'gid://gitlab/List/1', fromListId: 'gid://gitlab/List/1',
toListId: 'gid://gitlab/List/2', toListId: 'gid://gitlab/List/2',
}, },
state, state,
[ expectedMutations: [
{ {
type: types.MOVE_EPIC, type: types.MOVE_EPIC,
payload: { payload: {
...@@ -1070,9 +1068,7 @@ describe('moveEpic', () => { ...@@ -1070,9 +1068,7 @@ describe('moveEpic', () => {
}, },
}, },
], ],
[], });
done,
);
}); });
}); });
......
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