Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
Question 3 of 7 · Testing React Applications
Interview question

How do you test async operations? Async operations को कैसे test करें?

Answer
test('fetches data', async () => {
  render(<DataComponent />);
  const element = await screen.findByText(/data/i);
  expect(element).toBeInTheDocument();
});
async/await और findBy से async operations test कर सकते हैं।

Was this answer clear?