Chatwoot/app/javascript/dashboard/mixins/specs/agentMixin.spec.js
Muhsin Keloth 64e69a85f8
chore: Update availability status everywhere if the user changes the status from the account menu (#2581)
* add agent mixin

* apply agent mixin in components

* review fixes

* fix specs
2021-07-09 13:20:54 +05:30

38 lines
936 B
JavaScript

import { shallowMount, createLocalVue } from '@vue/test-utils';
import agentMixin from '../agentMixin';
import agentFixtures from './agentFixtures';
import Vuex from 'vuex';
const localVue = createLocalVue();
localVue.use(Vuex);
describe('agentMixin', () => {
let getters;
let store;
beforeEach(() => {
getters = {
getCurrentUser: () => ({
id: 1,
availability_status: 'busy',
}),
};
store = new Vuex.Store({ getters });
});
it('return formatted agents', () => {
const Component = {
render() {},
title: 'TestComponent',
mixins: [agentMixin],
data() {
return { inboxId: 1 };
},
computed: {
assignableAgents() {
return agentFixtures.allAgents;
},
},
};
const wrapper = shallowMount(Component, { store, localVue });
expect(wrapper.vm.agentsList).toEqual(agentFixtures.formattedAgents);
});
});