feat: Display reply time in widget (#1349)

Fixes #1132
This commit is contained in:
Pranav Raj S 2020-10-18 23:32:22 +05:30 committed by GitHub
parent bd11b2ec58
commit 85514cae8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 707 additions and 345 deletions

View file

@ -1,49 +0,0 @@
import { createWrapper } from '@vue/test-utils';
import agentMixin from '../agentMixin';
import Vue from 'vue';
const translations = {
'AGENT_AVAILABILITY.IS_AVAILABLE': 'is available',
'AGENT_AVAILABILITY.ARE_AVAILABLE': 'are available',
'AGENT_AVAILABILITY.OTHERS_ARE_AVAILABLE': 'others are available',
'AGENT_AVAILABILITY.AND': 'and',
};
const TestComponent = {
render() {},
title: 'TestComponent',
mixins: [agentMixin],
methods: {
$t(key) {
return translations[key];
},
},
};
describe('agentMixin', () => {
test('returns correct text', () => {
const Constructor = Vue.extend(TestComponent);
const vm = new Constructor().$mount();
const wrapper = createWrapper(vm);
expect(wrapper.vm.getAvailableAgentsText([{ name: 'Pranav' }])).toEqual(
'Pranav is available'
);
expect(
wrapper.vm.getAvailableAgentsText([
{ name: 'Pranav' },
{ name: 'Nithin' },
])
).toEqual('Pranav and Nithin are available');
expect(
wrapper.vm.getAvailableAgentsText([
{ name: 'Pranav' },
{ name: 'Nithin' },
{ name: 'Subin' },
{ name: 'Sojan' },
])
).toEqual('Pranav and 3 others are available');
});
});