import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event'
import { Account } from './Account';
import { ErrorBoundary } from './ErrorBoundary';
describe('Account', () => {
it('renders a fallback when an account error is thrown', async () => {
const fallback = jest.fn(() => (
<button>Try Again</button>
));
const user = userEvent.setup();
render(
<ErrorBoundary fallback={fallback}>
<Account />
</ErrorBoundary>
);
await userEvent.click(screen.getByRole('button', { name: /try again/i });
expect(fallback).toHaveBeenCalledTimes(1);
});
});