import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import ActionButton from '../src/components/account/ActionButton.jsx';

describe('ActionButton Component', () => {
  it('should render with the correct title and call the action when clicked', () => {
    const mockAction = jest.fn();
    const title = 'Click Me';

    render(<ActionButton action={mockAction} title={title} />);

    const buttonElement = screen.getByText(title);
    expect(buttonElement).toBeInTheDocument();

    fireEvent.click(buttonElement);
    expect(mockAction).toHaveBeenCalledTimes(1);
  });
});
