chore: update fixture
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
// Vitest Snapshot v1
|
||||
|
||||
exports[`Counter.vue > should render 1`] = `"<div>10 <button class=\\"inc\\"> + </button><button class=\\"dec\\"> - </button></div>"`;
|
7
fixtures/vitesse/test/basic.test.ts
Normal file
7
fixtures/vitesse/test/basic.test.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
describe('tests', () => {
|
||||
it('should works', () => {
|
||||
expect(1 + 1).toEqual(2)
|
||||
})
|
||||
})
|
28
fixtures/vitesse/test/component.test.ts
Normal file
28
fixtures/vitesse/test/component.test.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import Counter from '../src/components/Counter.vue'
|
||||
|
||||
describe('Counter.vue', () => {
|
||||
it('should render', () => {
|
||||
const wrapper = mount(Counter, { props: { initial: 10 } })
|
||||
expect(wrapper.text()).toContain('10')
|
||||
expect(wrapper.html()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should be interactive', async () => {
|
||||
const wrapper = mount(Counter, { props: { initial: 0 } })
|
||||
expect(wrapper.text()).toContain('0')
|
||||
|
||||
expect(wrapper.find('.inc').exists()).toBe(true)
|
||||
|
||||
expect(wrapper.find('.dec').exists()).toBe(true)
|
||||
|
||||
await wrapper.get('.inc').trigger('click')
|
||||
|
||||
expect(wrapper.text()).toContain('1')
|
||||
|
||||
await wrapper.get('.dec').trigger('click')
|
||||
|
||||
expect(wrapper.text()).toContain('0')
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user