chore: Change the conversation bot status to pending (#2677)

fixes: #2649
This commit is contained in:
Sojan Jose 2021-07-21 22:02:43 +05:30 committed by GitHub
parent a0886d37bc
commit a7ca55c080
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 87 additions and 54 deletions

View file

@ -7,10 +7,10 @@ jest.mock('widget/helpers/axios');
describe('#actions', () => {
describe('#get attributes', () => {
it('sends mutation if api is success', async () => {
API.get.mockResolvedValue({ data: { id: 1, status: 'bot' } });
API.get.mockResolvedValue({ data: { id: 1, status: 'pending' } });
await actions.getAttributes({ commit });
expect(commit.mock.calls).toEqual([
['SET_CONVERSATION_ATTRIBUTES', { id: 1, status: 'bot' }],
['SET_CONVERSATION_ATTRIBUTES', { id: 1, status: 'pending' }],
['conversation/setMetaUserLastSeenAt', undefined, { root: true }],
]);
});
@ -23,10 +23,10 @@ describe('#actions', () => {
describe('#update attributes', () => {
it('sends correct mutations', () => {
actions.update({ commit }, { id: 1, status: 'bot' });
actions.update({ commit }, { id: 1, status: 'pending' });
expect(commit).toBeCalledWith('UPDATE_CONVERSATION_ATTRIBUTES', {
id: 1,
status: 'bot',
status: 'pending',
});
});
});

View file

@ -4,11 +4,11 @@ describe('#getters', () => {
it('getConversationParams', () => {
const state = {
id: 1,
status: 'bot',
status: 'pending',
};
expect(getters.getConversationParams(state)).toEqual({
id: 1,
status: 'bot',
status: 'pending',
});
});
});

View file

@ -14,7 +14,7 @@ describe('#mutations', () => {
describe('#UPDATE_CONVERSATION_ATTRIBUTES', () => {
it('update status if it is same conversation', () => {
const state = { id: 1, status: 'bot' };
const state = { id: 1, status: 'pending' };
mutations.UPDATE_CONVERSATION_ATTRIBUTES(state, {
id: 1,
status: 'open',
@ -22,12 +22,12 @@ describe('#mutations', () => {
expect(state).toEqual({ id: 1, status: 'open' });
});
it('doesnot update status if it is not the same conversation', () => {
const state = { id: 1, status: 'bot' };
const state = { id: 1, status: 'pending' };
mutations.UPDATE_CONVERSATION_ATTRIBUTES(state, {
id: 2,
status: 'open',
});
expect(state).toEqual({ id: 1, status: 'bot' });
expect(state).toEqual({ id: 1, status: 'pending' });
});
});