import '@testing-library/jest-dom'
import {
  render,
  screen,
  waitForElementToBeRemoved, // this line was added
} from '@testing-library/react'
import { App } from './App'

it('renders hello message', async () => { // this line was updated
  render(<App />)
  expect(screen.getByText('Hello Vite + React!')).toBeInTheDocument()
  expect(
    screen.getByRole('heading', { level: 1, name: 'Users' })
  ).toBeInTheDocument()
  const loading = screen.getByText('Loading...') // this line was added
  await waitForElementToBeRemoved(loading) // this line was added
  expect(screen.getByRole('list')).toBeInTheDocument()
  expect(screen.getAllByRole('listitem')).toHaveLength(10)
})