Files
tacticalrmm-web/test/vitest/__tests__/ExampleComponent.test.ts
sadnub 0fbd3a59bd init
2024-04-16 22:03:54 -04:00

39 lines
1.0 KiB
TypeScript

import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-vitest';
import { mount } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';
import ExampleComponent from './demo/ExampleComponent.vue';
installQuasarPlugin();
describe('example Component', () => {
it('should mount component with todos', async () => {
const wrapper = mount(ExampleComponent, {
props: {
title: 'Hello',
meta: {
totalCount: 4,
},
todos: [
{ id: 1, content: 'Hallo' },
{ id: 2, content: 'Hoi' },
],
},
});
expect(wrapper.vm.clickCount).toBe(0);
await wrapper.find('.q-item').trigger('click');
expect(wrapper.vm.clickCount).toBe(1);
});
it('should mount component without todos', () => {
const wrapper = mount(ExampleComponent, {
props: {
title: 'Hello',
meta: {
totalCount: 4,
},
},
});
expect(wrapper.findAll('.q-item')).toHaveLength(0);
});
});