typescript 使用Vitest for Lit组件创建快照测试

wrrgggsh  于 2023-03-24  发布在  TypeScript
关注(0)|答案(1)|浏览(217)

我看到一些关于React的教程,但不清楚这将如何与Lit一起工作。具体来说,是否有类似react-test-renderer的东西,但用于Lit?

e3bfsja2

e3bfsja21#

import { it, describe, expect } from 'vitest';
import { shallowMount, mount } from '@vue/test-utils'
import App from '@/App.vue'

describe('App', () => {

  it('renders correctly', () => {
    const wrapper = shallowMount(App)
    expect(wrapper).toMatchSnapshot()
  })

  it('renders the correct markup', () => {
    const wrapper = shallowMount(App)
    expect(wrapper.html()).toContain('router-view')
  })
})

相关问题