1
0
Fork 0

tests: add tests

This commit is contained in:
Vojtěch Mareš 2022-12-09 02:13:27 +01:00
parent e7392c3bd7
commit 65adc7f0c0
2 changed files with 38 additions and 0 deletions

19
tests/Button.test.tsx Normal file
View 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()
})