Skip to content

Commit 81fde9c

Browse files
committed
test: add some simple web tests
1 parent a2fea02 commit 81fde9c

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

web/src/App.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
import { render } from '@testing-library/react'
1+
import { render, screen } from '@testing-library/react'
22
import App from './App'
33

44
test('renders without crashing', () => {
55
render(<App />)
66
})
7+
test('has an input field', () => {
8+
render(<App />)
9+
expect(screen.getByPlaceholderText('Add Task')).toBeDefined()
10+
})
11+
test('has an Add button', () => {
12+
render(<App />)
13+
expect(screen.getByText('Add')).toBeDefined()
14+
})

web/src/setupTests.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
// expect(element).toHaveTextContent(/react/i)
44
// learn more: https://github.com/testing-library/jest-dom
55
import '@testing-library/jest-dom'
6+
import { cleanup } from '@testing-library/react'
7+
import { afterEach } from 'vitest'
8+
9+
afterEach(() => {
10+
cleanup()
11+
})

0 commit comments

Comments
 (0)