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()
  })
})
