16 lines
449 B
JavaScript
16 lines
449 B
JavaScript
import { render, screen, fireEvent } from '@testing-library/react'
|
|
import App from './App'
|
|
|
|
describe('App', () => {
|
|
it('renders without crashing', () => {
|
|
render(<App />)
|
|
expect(screen.getByText(/React App/i)).toBeInTheDocument()
|
|
})
|
|
|
|
it('calculates correctly when button is clicked', () => {
|
|
render(<App />)
|
|
fireEvent.click(screen.getByText(/Calculate/i))
|
|
expect(screen.getByText(/Result: 8/i)).toBeInTheDocument()
|
|
})
|
|
})
|