Skip to content

Commit

Permalink
test: add some simple web tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ingeridhellen committed Sep 5, 2023
1 parent a2fea02 commit 81fde9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { render } from '@testing-library/react'
import { render, screen } from '@testing-library/react'
import App from './App'

test('renders without crashing', () => {
render(<App />)
})
test('has an input field', () => {
render(<App />)
expect(screen.getByPlaceholderText('Add Task')).toBeDefined()
})
test('has an Add button', () => {
render(<App />)
expect(screen.getByText('Add')).toBeDefined()
})
6 changes: 6 additions & 0 deletions web/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom'
import { cleanup } from '@testing-library/react'
import { afterEach } from 'vitest'

afterEach(() => {
cleanup()
})

0 comments on commit 81fde9c

Please sign in to comment.