Enhancement: Upgrade @babel/preset-env (#542)

This commit is contained in:
Pranav Raj S
2020-02-22 20:16:56 +05:30
committed by GitHub
parent a790dc640f
commit 1261cc7783
7 changed files with 775 additions and 1690 deletions

View File

@@ -91,28 +91,40 @@ describe('#actions', () => {
]);
});
});
describe('#updateAutoAssignment', () => {
it('sends correct actions if API is success', async () => {
let updatedInbox = inboxList[0];
const updatedInbox = inboxList[0];
updatedInbox.enable_auto_assignment = false;
axios.patch.mockResolvedValue({ data: updatedInbox });
await actions.updateAutoAssignment({ commit }, { id: updatedInbox.id, inbox: { enable_auto_assignment: false} });
await actions.updateAutoAssignment(
{ commit },
{ id: updatedInbox.id, inbox: { enable_auto_assignment: false } }
);
expect(commit.mock.calls).toEqual([
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: true }],
[types.default.EDIT_INBOXES, updatedInbox],
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: false }],
[
types.default.SET_INBOXES_UI_FLAG,
{ isUpdatingAutoAssignment: false },
],
]);
});
it('sends correct actions if API is error', async () => {
axios.patch.mockRejectedValue({ message: 'Incorrect header' });
await expect(
actions.updateAutoAssignment({ commit }, { id: inboxList[0].id, inbox: { enable_auto_assignment: false} })
actions.updateAutoAssignment(
{ commit },
{ id: inboxList[0].id, inbox: { enable_auto_assignment: false } }
)
).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: true }],
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: false }],
[
types.default.SET_INBOXES_UI_FLAG,
{ isUpdatingAutoAssignment: false },
],
]);
});
});