cfdf4a12c8
* complete dshboard api specs * code cleanup * add conversation mixin spec * add isadmin mixin spec * add agent details component spec * add notification badge spec * spec for thumbnail exist in agent details * fix the deprecation warnings * add agent details spec * add account selector specs * code cleanup * refactor contact spec * review fixes * review fixes * add shared spec helper * update api spec helper * review fixes
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
import { mount } from '@vue/test-utils';
|
|
import Avatar from './Avatar.vue';
|
|
import Thumbnail from './Thumbnail.vue';
|
|
|
|
describe(`when there are NO errors loading the thumbnail`, () => {
|
|
it(`should render the agent thumbnail`, () => {
|
|
const wrapper = mount(Thumbnail, {
|
|
propsData: {
|
|
src: 'https://some_valid_url.com',
|
|
},
|
|
data() {
|
|
return {
|
|
imgError: false,
|
|
};
|
|
},
|
|
});
|
|
expect(wrapper.find('#image').exists()).toBe(true);
|
|
const avatarComponent = wrapper.findComponent(Avatar);
|
|
expect(avatarComponent.exists()).toBe(false);
|
|
});
|
|
});
|
|
|
|
describe(`when there ARE errors loading the thumbnail`, () => {
|
|
it(`should render the agent avatar`, () => {
|
|
const wrapper = mount(Thumbnail, {
|
|
propsData: {
|
|
src: 'https://some_invalid_url.com',
|
|
},
|
|
data() {
|
|
return {
|
|
imgError: true,
|
|
};
|
|
},
|
|
});
|
|
expect(wrapper.find('#image').exists()).toBe(false);
|
|
const avatarComponent = wrapper.findComponent(Avatar);
|
|
expect(avatarComponent.exists()).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe(`when Avatar shows`, () => {
|
|
it(`initials shold correspond to username`, () => {
|
|
const wrapper = mount(Avatar, {
|
|
propsData: {
|
|
username: 'Angie Rojas',
|
|
},
|
|
});
|
|
expect(wrapper.find('span').text()).toBe('AR');
|
|
});
|
|
});
|