2020-05-09 16:32:43 +00:00
|
|
|
import { mutations } from '../../conversationAttributes';
|
|
|
|
|
|
|
|
describe('#mutations', () => {
|
|
|
|
describe('#SET_CONVERSATION_ATTRIBUTES', () => {
|
|
|
|
it('set status of the conversation', () => {
|
|
|
|
const state = { id: '', status: '' };
|
|
|
|
mutations.SET_CONVERSATION_ATTRIBUTES(state, {
|
|
|
|
id: 1,
|
|
|
|
status: 'open',
|
|
|
|
});
|
|
|
|
expect(state).toEqual({ id: 1, status: 'open' });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#UPDATE_CONVERSATION_ATTRIBUTES', () => {
|
|
|
|
it('update status if it is same conversation', () => {
|
2021-07-21 16:32:43 +00:00
|
|
|
const state = { id: 1, status: 'pending' };
|
2020-05-09 16:32:43 +00:00
|
|
|
mutations.UPDATE_CONVERSATION_ATTRIBUTES(state, {
|
|
|
|
id: 1,
|
|
|
|
status: 'open',
|
|
|
|
});
|
|
|
|
expect(state).toEqual({ id: 1, status: 'open' });
|
|
|
|
});
|
|
|
|
it('doesnot update status if it is not the same conversation', () => {
|
2021-07-21 16:32:43 +00:00
|
|
|
const state = { id: 1, status: 'pending' };
|
2020-05-09 16:32:43 +00:00
|
|
|
mutations.UPDATE_CONVERSATION_ATTRIBUTES(state, {
|
|
|
|
id: 2,
|
|
|
|
status: 'open',
|
|
|
|
});
|
2021-07-21 16:32:43 +00:00
|
|
|
expect(state).toEqual({ id: 1, status: 'pending' });
|
2020-05-09 16:32:43 +00:00
|
|
|
});
|
|
|
|
});
|
2021-06-30 15:39:44 +00:00
|
|
|
|
|
|
|
describe('#CLEAR_CONVERSATION_ATTRIBUTES', () => {
|
|
|
|
it('clear status if it is same conversation', () => {
|
|
|
|
const state = { id: 1, status: 'open' };
|
|
|
|
mutations.CLEAR_CONVERSATION_ATTRIBUTES(state, {
|
|
|
|
id: 1,
|
|
|
|
status: 'open',
|
|
|
|
});
|
|
|
|
expect(state).toEqual({ id: '', status: '' });
|
|
|
|
});
|
|
|
|
});
|
2020-05-09 16:32:43 +00:00
|
|
|
});
|