Unit Test
Jest
import React from 'react'
import ReactDOM from 'react-dom'
import { ResourceName } from 'resourcePath'
describe('ResourceName', () => {
it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<ResourceName />, div)
})
})
Jest > Testing Library
import { render, screen } from '@testing-library/react'
import ResourceName from 'resourcePath/ResourceName'
describe('ResourceName', () => {
it('renders welcome message', () => {
render(<ResourceName />)
expect(
screen.getByText("Hello, I'm a component, auto generated by Clingon CLI!")
).toBeInTheDocument()
})
})
Vitest
import React from 'react'
import ReactDOM from 'react-dom'
import { ResourceName } from 'resourcePath'
describe('ResourceName', () => {
it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<ResourceName />, div)
})
})
Vitest > Testing Library
import { render, screen } from '@testing-library/react'
import ResourceName from 'resourcePath'
describe('ResourceName', () => {
it('renders welcome message', () => {
render(<ResourceName />)
expect(
screen.getByText("Hello, I'm a component, auto generated by Clingon CLI!")
).toBeInTheDocument()
})
})