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?