Avatar unit test updated
parent
f20b01257a
commit
f7cd6233a3
|
@ -1,20 +1,35 @@
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
|
import { beforeEach } from 'vitest';
|
||||||
import Avatar from './Avatar.vue';
|
import Avatar from './Avatar.vue';
|
||||||
|
let wrapper = null;
|
||||||
|
|
||||||
describe('Avatar.vue', () => {
|
beforeEach(() => {
|
||||||
it('should exist', () => {
|
wrapper = mount(Avatar, {
|
||||||
const wrapper = mount(Avatar, {
|
|
||||||
props: {
|
props: {
|
||||||
label: 'T',
|
label: 'T',
|
||||||
size: 'large',
|
size: 'large',
|
||||||
shape: 'circle'
|
shape: 'circle',
|
||||||
|
image: 'test'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Avatar.vue', () => {
|
||||||
|
it('should exist', () => {
|
||||||
expect(wrapper.find('.p-avatar.p-component').exists()).toBe(true);
|
expect(wrapper.find('.p-avatar.p-component').exists()).toBe(true);
|
||||||
expect(wrapper.find('.p-avatar-lg').exists()).toBe(true);
|
expect(wrapper.find('.p-avatar-lg').exists()).toBe(true);
|
||||||
expect(wrapper.find('.p-avatar-circle').exists()).toBe(true);
|
expect(wrapper.find('.p-avatar-circle').exists()).toBe(true);
|
||||||
expect(wrapper.find('.p-avatar-text').exists()).toBe(true);
|
expect(wrapper.find('.p-avatar-text').exists()).toBe(true);
|
||||||
expect(wrapper.find('.p-avatar-text').text()).toBe('T');
|
expect(wrapper.find('.p-avatar-text').text()).toBe('T');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should exist', async () => {
|
||||||
|
await wrapper.setProps({ image: 'imageTest' });
|
||||||
|
const image = wrapper.find('.p-avatar-image');
|
||||||
|
|
||||||
|
await wrapper.vm.onError();
|
||||||
|
|
||||||
|
expect(image.exists()).toBe(true);
|
||||||
|
expect(wrapper.emitted().error.length).toBe(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue