diff --git a/src/components/VAvatarSettings/VAvatarSettings.test.ts b/src/components/VAvatarSettings/VAvatarSettings.test.ts index 0c1ccbe1..8b8e9956 100644 --- a/src/components/VAvatarSettings/VAvatarSettings.test.ts +++ b/src/components/VAvatarSettings/VAvatarSettings.test.ts @@ -27,6 +27,7 @@ describe('VAvatarSettings', () => { ], stubs: { VCard: false, + AvatarCropper: true, }, }, }); diff --git a/src/components/VHeader/VHeader.test.ts b/src/components/VHeader/VHeader.test.ts index b8517cb2..d66b8dea 100644 --- a/src/components/VHeader/VHeader.test.ts +++ b/src/components/VHeader/VHeader.test.ts @@ -1,4 +1,4 @@ -import { mount, VueWrapper } from '@vue/test-utils'; +import { mount, RouterLinkStub, VueWrapper } from '@vue/test-utils'; import { faker } from '@faker-js/faker'; import VHeader from './VHeader.vue'; import { useRoute } from 'vue-router'; @@ -9,7 +9,14 @@ describe('VHeader', () => { let wrapper: VueWrapper>; const mountComponent = () => { - wrapper = mount(VHeader, { shallow: true }); + wrapper = mount(VHeader, { + shallow: true, + global: { + stubs: { + RouterLink: RouterLinkStub, + }, + }, + }); }; beforeEach(() => { @@ -20,12 +27,12 @@ describe('VHeader', () => { mountComponent(); }); - const getLogoWrapper = () => wrapper.find('[data-testid="logo"]'); + const getLogoWrapper = () => wrapper.findComponent(RouterLinkStub); const getProfileMenuWrapper = () => wrapper.find('[data-testid="profile"]'); test('has logo that leads to home page', () => { expect(getLogoWrapper().exists()).toBe(true); - expect(getLogoWrapper().attributes('to')).toBe('/'); + expect(getLogoWrapper().props().to).toBe('/'); }); test('has profile menu if route is private', () => { diff --git a/src/components/VRadioSwitch/VRadioSwitch.test.ts b/src/components/VRadioSwitch/VRadioSwitch.test.ts index c13aea45..79e37eb9 100644 --- a/src/components/VRadioSwitch/VRadioSwitch.test.ts +++ b/src/components/VRadioSwitch/VRadioSwitch.test.ts @@ -1,4 +1,4 @@ -import { mount } from '@vue/test-utils'; +import { mount, shallowMount } from '@vue/test-utils'; import { describe, test, expect } from 'vitest'; import VRadioSwitch from './VRadioSwitch.vue'; import { SunFilledIcon, MoonFilledIcon } from 'vue-tabler-icons'; @@ -10,7 +10,7 @@ describe('VRadioSwitch', () => { ]; test('renders all options', () => { - const wrapper = mount(VRadioSwitch, { + const wrapper = shallowMount(VRadioSwitch, { props: { options, modelValue: 'option1', @@ -30,7 +30,7 @@ describe('VRadioSwitch', () => { }); test('highlights active option', () => { - const wrapper = mount(VRadioSwitch, { + const wrapper = shallowMount(VRadioSwitch, { props: { options, modelValue: 'option2', @@ -49,7 +49,7 @@ describe('VRadioSwitch', () => { }); test('emits update:modelValue event on click', async () => { - const wrapper = mount(VRadioSwitch, { + const wrapper = shallowMount(VRadioSwitch, { props: { options, modelValue: 'option1', diff --git a/src/stores/homework.ts b/src/stores/homework.ts index 828e92c0..65c494ce 100644 --- a/src/stores/homework.ts +++ b/src/stores/homework.ts @@ -60,7 +60,6 @@ const useHomework = defineStore('homework', { ) { (answers || this.answers).forEach((item) => { if (item.slug === answer.slug) { - console.log(answer, item); return Object.assign(item, answer); }