diff --git a/web/src/App.test.tsx b/web/src/App.test.tsx index df08a9cd..032146f6 100644 --- a/web/src/App.test.tsx +++ b/web/src/App.test.tsx @@ -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() }) +test('has an input field', () => { + render() + expect(screen.getByPlaceholderText('Add Task')).toBeDefined() +}) +test('has an Add button', () => { + render() + expect(screen.getByText('Add')).toBeDefined() +}) diff --git a/web/src/setupTests.ts b/web/src/setupTests.ts index 52aaef1d..8b7e296b 100644 --- a/web/src/setupTests.ts +++ b/web/src/setupTests.ts @@ -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() +})