2ce7438c79
* Cleanup agent store and actions * Move set/create/update/destroy to helpers * Update mutation specs * Add specs for API helper * Fix edit/delete action visibility * Add actions specs * Remove unused API helpers * Remove duplicates * Remove duplicates * Fix duplicate
80 lines
1.6 KiB
JavaScript
80 lines
1.6 KiB
JavaScript
import { getters } from '../../agents';
|
|
|
|
describe('#getters', () => {
|
|
it('getAgents', () => {
|
|
const state = {
|
|
records: [
|
|
{
|
|
id: 1,
|
|
name: 'Agent 1',
|
|
email: 'agent1@chatwoot.com',
|
|
confirmed: true,
|
|
},
|
|
{
|
|
id: 2,
|
|
name: 'Agent 2',
|
|
email: 'agent2@chatwoot.com',
|
|
confirmed: false,
|
|
},
|
|
],
|
|
};
|
|
expect(getters.getAgents(state)).toEqual([
|
|
{
|
|
id: 1,
|
|
name: 'Agent 1',
|
|
email: 'agent1@chatwoot.com',
|
|
confirmed: true,
|
|
},
|
|
{
|
|
id: 2,
|
|
name: 'Agent 2',
|
|
email: 'agent2@chatwoot.com',
|
|
confirmed: false,
|
|
},
|
|
]);
|
|
});
|
|
|
|
it('getVerifiedAgents', () => {
|
|
const state = {
|
|
records: [
|
|
{
|
|
id: 1,
|
|
name: 'Agent 1',
|
|
email: 'agent1@chatwoot.com',
|
|
confirmed: true,
|
|
},
|
|
{
|
|
id: 2,
|
|
name: 'Agent 2',
|
|
email: 'agent2@chatwoot.com',
|
|
confirmed: false,
|
|
},
|
|
],
|
|
};
|
|
expect(getters.getVerifiedAgents(state)).toEqual([
|
|
{
|
|
id: 1,
|
|
name: 'Agent 1',
|
|
email: 'agent1@chatwoot.com',
|
|
confirmed: true,
|
|
},
|
|
]);
|
|
});
|
|
|
|
it('getUIFlags', () => {
|
|
const state = {
|
|
uiFlags: {
|
|
isFetching: true,
|
|
isCreating: false,
|
|
isUpdating: false,
|
|
isDeleting: false,
|
|
},
|
|
};
|
|
expect(getters.getUIFlags(state)).toEqual({
|
|
isFetching: true,
|
|
isCreating: false,
|
|
isUpdating: false,
|
|
isDeleting: false,
|
|
});
|
|
});
|
|
});
|