tests: add tests
This commit is contained in:
parent
e7392c3bd7
commit
65adc7f0c0
2 changed files with 38 additions and 0 deletions
19
tests/Button.test.tsx
Normal file
19
tests/Button.test.tsx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { expect, test } from 'vitest'
|
||||
import { render, screen, cleanup } from '@testing-library/react'
|
||||
import { Button } from '@/components/Button'
|
||||
|
||||
test('button', () => {
|
||||
render(<Button>Hello</Button>)
|
||||
|
||||
expect(screen.getByText('Hello')).toBeDefined()
|
||||
|
||||
cleanup()
|
||||
})
|
||||
|
||||
test('button-with-link', () => {
|
||||
render(<Button href="/country-road">Hello</Button>)
|
||||
|
||||
expect(screen.getByText('Hello').getAttribute('href')).toBe('/country-road')
|
||||
|
||||
cleanup()
|
||||
})
|
||||
Reference in a new issue