Unit Test
Jest
Vue Test Utils
import { shallowMount } from '@vue/test-utils'
import ResourceName from 'resourcePath'
describe('ResourceName', () => {
const wrapper = shallowMount(ResourceName)
it('renders the correct message', () => {
expect(wrapper.text()).toBe("Hello, I'm a resource auto generated by Clingon CLI!")
})
})
Testing Library
import { render, screen } from '@testing-library/vue'
import ResourceName from 'resourcePath'
describe('ResourceName', () => {
const componentData = {
props: {},
slots: {}
}
it('renders the correct message', () => {
render(ResourceName, componentData)
expect(
screen.getByText("Hello, I'm a resource auto generated by Clingon CLI!")
).toBeInTheDocument()
})
})
Vitest
Testing Library
import { render, screen } from '@testing-library/vue'
import { describe, it, expect } from 'vitest'
import ResourceName from 'resourcePath'
describe('ResourceName', () => {
const componentData = {
props: {},
slots: {}
}
it('renders the correct message', () => {
render(ResourceName, componentData)
expect(
screen.getByText("Hello, I'm a resource auto generated by Clingon CLI!")
).toBeInTheDocument()
})
})
Vue Test Utils
import { shallowMount } from '@vue/test-utils'
import { describe, it, expect } from 'vitest'
import ResourceName from 'resourcePath'
describe('ResourceName', () => {
const wrapper = shallowMount(ResourceName)
it('renders the correct message', () => {
expect(wrapper.text()).toBe("Hello, I'm a resource auto generated by Clingon CLI!")
})
})