mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
Enhancement: Upgrade @babel/preset-env (#542)
This commit is contained in:
@@ -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 },
|
||||
],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user