describe('Async API Tests', () => {
let mockUser;
// Example using beforeEach to set up async state before each test
beforeEach(async () => {
mockUser = { id: 1, name: 'Jane Doe' };
axios.get.mockResolvedValue({ data: mockUser });
});
it('fetches user asynchronously', async () => {
const result = await fetchData('https://api.example.com/user/1');
expect(result).toEqual(mockUser);
});
});