first commit

This commit is contained in:
2024-11-05 12:22:50 +01:00
commit e5682a3912
19641 changed files with 2948548 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import Vue from 'vue';
import {shallowMount} from '@vue/test-utils';
import Button from '@components/Button/Button.vue';
import EventBus from '@components/EventBus';
describe('Button.vue', () => {
it('should stay unchecked if user is not logged in', async () => {
const wrapper = shallowMount(Button);
expect(wrapper.vm.isChecked).toBe(false);
wrapper.find('button').trigger('click');
await Vue.nextTick();
expect(wrapper.vm.isChecked).toBe(false);
});
it('should be checked if it receive the event addedToWishlist', async () => {
const wrapper = shallowMount(Button, {
propsData: {
productId: 1
}
});
EventBus.$emit('addedToWishlist', {
detail: {productId: 1, listId: 1}
});
expect(wrapper.vm.isChecked).toBe(true);
});
it('should be checked if we passe checked as a prop', async () => {
const wrapper = shallowMount(Button, {
propsData: {
productId: 1,
checked: 'true'
}
});
expect(wrapper.vm.isChecked).toBe(true);
});
});