Unit test fixes after major updates

This commit is contained in:
Bahadır Sofuoğlu 2023-08-31 12:46:08 +03:00
parent fe60480678
commit acfaf6af9f
13 changed files with 21 additions and 59 deletions

View file

@ -21,7 +21,9 @@ beforeEach(() => {
},
props: {
item: { label: 'Computer', visible: () => true },
template: null
templates: {
item: undefined
}
}
});
});
@ -31,8 +33,8 @@ afterEach(() => {
});
describe('BreadcrumbItem', () => {
it('When component is mount, text should be exists', () => {
expect(wrapper.find('.p-menuitem-text').exists()).toBe(true);
it('When component is mount and template.item equal to null, text should not be exists', () => {
expect(wrapper.find('.p-menuitem-text').exists()).toBe(false);
});
it('When tag is triggered, onClick method should be called', async () => {
@ -53,18 +55,6 @@ describe('BreadcrumbItem', () => {
expect(spy).toHaveBeenCalled();
});
it('When linkClass method called and isActive-isExactActive, tag classes should be effected', async () => {
await wrapper.setProps({ exact: true });
expect(wrapper.vm.linkClass({ isActive: true, isExactActive: true })).toEqual([
'p-menuitem-link',
{
'router-link-active': true,
'router-link-active-exact': true
}
]);
});
it('When item prop has a visible, visible method should be return falsy', async () => {
await wrapper.setProps({ item: { label: 'Computer', visible: false, command: vi.fn() } });