Feature: Availability Statuses (#874)

Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
Sojan Jose
2020-07-04 11:42:47 +05:30
committed by GitHub
parent bd87927576
commit c98907db49
35 changed files with 413 additions and 77 deletions

View File

@@ -25,4 +25,9 @@ describe('#actions', () => {
]);
});
});
describe('#updatePresence', () => {
actions.updatePresence({ commit }, { 1: 'online' });
expect(commit.mock.calls).toEqual([['updatePresence', { 1: 'online' }]]);
});
});

View File

@@ -1,5 +1,5 @@
import { mutations } from '../../agent';
import agents from './data';
import { agents } from './data';
describe('#mutations', () => {
describe('#setAgents', () => {
@@ -25,4 +25,35 @@ describe('#mutations', () => {
expect(state.uiFlags.hasFetched).toEqual(true);
});
});
describe('#updatePresence', () => {
it('updates agent presence', () => {
const state = { records: agents };
mutations.updatePresence(state, { 1: 'busy', 2: 'online' });
expect(state.records).toEqual([
{
id: 1,
name: 'John',
avatar_url: '',
availability_status: 'busy',
},
{
id: 2,
name: 'Xavier',
avatar_url: '',
availability_status: 'online',
},
{
id: 3,
name: 'Pranav',
avatar_url: '',
},
{
id: 4,
name: 'Nithin',
avatar_url: '',
},
]);
});
});
});