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 {
})
.then(({ data }) => {
if (data?.issueMoveList?.errors.length) {
commit(types.MOVE_ISSUE_FAILURE, { originalIssue, fromListId, toListId, originalIndex });
throw new Error();
} else {
const issue = data.issueMoveList?.issue;
commit(types.MOVE_ISSUE_SUCCESS, { issue });
......
......@@ -528,7 +528,7 @@ export default {
})
.then(({ data }) => {
if (data?.issueMoveList?.errors.length) {
commit(types.MOVE_ISSUE_FAILURE, { originalIssue, fromListId, toListId, originalIndex });
throw new Error();
} else {
const issue = data.issueMoveList?.issue;
commit(types.MOVE_ISSUE_SUCCESS, { issue });
......@@ -565,7 +565,7 @@ export default {
})
.then(({ data }) => {
if (data?.epicMoveList?.errors.length) {
commit(types.MOVE_EPIC_FAILURE, { originalEpic, fromListId, toListId, originalIndex });
throw new Error();
}
})
.catch(() =>
......
......@@ -1002,7 +1002,7 @@ describe('moveEpic', () => {
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({
data: {
epicMoveList: {
......@@ -1011,15 +1011,15 @@ describe('moveEpic', () => {
},
});
testAction(
actions.moveEpic,
{
await testAction({
action: actions.moveEpic,
payload: {
itemId: '41',
fromListId: 'gid://gitlab/List/1',
toListId: 'gid://gitlab/List/2',
},
state,
[
expectedMutations: [
{
type: types.MOVE_EPIC,
payload: {
......@@ -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({
data: {
epicMoveList: {
......@@ -1043,15 +1041,15 @@ describe('moveEpic', () => {
},
});
testAction(
actions.moveEpic,
{
await testAction({
action: actions.moveEpic,
payload: {
itemId: '41',
fromListId: 'gid://gitlab/List/1',
toListId: 'gid://gitlab/List/2',
},
state,
[
expectedMutations: [
{
type: types.MOVE_EPIC,
payload: {
......@@ -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