Feature: Add ability to disable auto assignment of conversations (#513)

This commit is contained in:
Tim Lange
2020-02-19 10:10:03 +01:00
committed by GitHub
parent e0afb84502
commit 30e5edf6dc
15 changed files with 377 additions and 230 deletions

View File

@@ -91,6 +91,31 @@ describe('#actions', () => {
]);
});
});
describe('#updateAutoAssignment', () => {
it('sends correct actions if API is success', async () => {
let 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} });
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 }],
]);
});
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} })
).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: true }],
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: false }],
]);
});
});
describe('#delete', () => {
it('sends correct actions if API is success', async () => {

View File

@@ -8,6 +8,7 @@ export default [
page_id: '12345',
widget_color: null,
website_token: null,
enable_auto_assignment: true,
},
{
id: 2,
@@ -18,6 +19,7 @@ export default [
page_id: null,
widget_color: '#7B64FF',
website_token: 'randomid123',
enable_auto_assignment: true,
},
{
id: 3,
@@ -28,6 +30,7 @@ export default [
page_id: null,
widget_color: '#68BC00',
website_token: 'randomid124',
enable_auto_assignment: true,
},
{
id: 4,
@@ -38,5 +41,6 @@ export default [
page_id: null,
widget_color: '#68BC00',
website_token: 'randomid125',
enable_auto_assignment: true,
},
];

View File

@@ -22,6 +22,7 @@ describe('#getters', () => {
page_id: '12345',
widget_color: null,
website_token: null,
enable_auto_assignment: true,
});
});
@@ -32,6 +33,7 @@ describe('#getters', () => {
isFetchingItem: false,
isCreating: false,
isUpdating: false,
isUpdatingAutoAssignment: false,
isDeleting: false,
},
};
@@ -40,6 +42,7 @@ describe('#getters', () => {
isFetchingItem: false,
isCreating: false,
isUpdating: false,
isUpdatingAutoAssignment: false,
isDeleting: false,
});
});