mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
feat: Ability to edit a contact (#1092)
Ability to edit contact information in conversation sidebar Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import axios from 'axios';
|
||||
import { actions } from '../../contacts';
|
||||
import * as types from '../../../mutation-types';
|
||||
import contactList from './fixtures';
|
||||
import { DuplicateContactException } from '../../../../../shared/helpers/CustomErrors';
|
||||
|
||||
const commit = jest.fn();
|
||||
global.axios = axios;
|
||||
@@ -68,6 +69,24 @@ describe('#actions', () => {
|
||||
[types.default.SET_CONTACT_UI_FLAG, { isUpdating: false }],
|
||||
]);
|
||||
});
|
||||
|
||||
it('sends correct actions if duplicate contact is found', async () => {
|
||||
axios.patch.mockRejectedValue({
|
||||
response: {
|
||||
data: {
|
||||
message: 'Incorrect header',
|
||||
contact: { id: 1, name: 'contact-name' },
|
||||
},
|
||||
},
|
||||
});
|
||||
await expect(actions.update({ commit }, contactList[0])).rejects.toThrow(
|
||||
DuplicateContactException
|
||||
);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_CONTACT_UI_FLAG, { isUpdating: true }],
|
||||
[types.default.SET_CONTACT_UI_FLAG, { isUpdating: false }],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#setContact', () => {
|
||||
|
||||
Reference in New Issue
Block a user