Untitled

 avatar
unknown
plain_text
16 days ago
1.2 kB
12
Indexable
import type { ComponentMountingOptions, VueWrapper } from '@vue/test-utils'
import { shallowMount } from '@vue/test-utils'
// import { createTestingPinia } from '@pinia/testing'

import type { ComponentNameProps } from '..'
import { ComponentName } from '..'

let wrapper: VueWrapper | null

const props: ComponentNameProps = {

}

const baseOptions: ComponentMountingOptions<typeof ComponentName> = {
    // По умолчанию отключено для экономии памяти, включить при необходимости
    // global: {
    //  plugins: [createTestingPinia({
    //         // Мок экшенов стора выключен, чтобы методы срабатывали и
    //      stubActions: false,
    //  })],
    // },
    props,
}

beforeEach(() => {
    // При необходимости монтирования дочерних компонентов использовать mount
    wrapper = shallowMount(ComponentName, baseOptions)
})

afterEach(() => {
    wrapper = null
})

describe('ComponentName', () => {
    it('Компонент рендерится', () => {
        expect(wrapper?.exists()).toBe(true)
    })
})
Leave a Comment