Feature: Customise widget for bot conversations (#834)

* Feature: Customise widget for bot conversations
This commit is contained in:
Pranav Raj S 2020-05-09 22:02:43 +05:30 committed by GitHub
parent 05ea6308f2
commit f28ec29b8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 298 additions and 26 deletions

View file

@ -0,0 +1,35 @@
import { createWrapper } from '@vue/test-utils';
import configMixin from '../configMixin';
import Vue from 'vue';
global.chatwootWebChannel = {
hideInputForBotConversations: true,
avatarUrl: 'https://test.url',
hasAConnectedAgentBot: 'AgentBot',
};
global.chatwootWidgetDefaults = {
useInboxAvatarForBot: true,
};
describe('configMixin', () => {
test('returns config', () => {
const Component = {
render() {},
title: 'TestComponent',
mixins: [configMixin],
};
const Constructor = Vue.extend(Component);
const vm = new Constructor().$mount();
const wrapper = createWrapper(vm);
expect(wrapper.vm.hideInputForBotConversations).toBe(true);
expect(wrapper.vm.hasAConnectedAgentBot).toBe(true);
expect(wrapper.vm.useInboxAvatarForBot).toBe(true);
expect(wrapper.vm.inboxAvatarUrl).toBe('https://test.url');
expect(wrapper.vm.channelConfig).toEqual({
hideInputForBotConversations: true,
avatarUrl: 'https://test.url',
hasAConnectedAgentBot: 'AgentBot',
});
});
});