import { render, screen } from '../../test-utils';
import Button, { ButtonProps } from '..';

describe('Button', () => {
  const legacyProps: ButtonProps = {
    useNewButton: false,
    priority: 'primary',
    size: 'md',
    type: 'accent',
  };

  const newProps: ButtonProps = {
    useNewButton: true,
    priority: 'primary',
    size: 'md',
    type: 'accent',
    testId: 'new-button',
  };

  it('renders LegacyButton when useNewButton is false', () => {
    render(<Button {...legacyProps}>Legacy Button</Button>);
    const button = screen.getByText('Legacy Button');
    expect(button).toBeInTheDocument();
    expect(button).toHaveClass('btn btn-md np-btn np-btn-md btn-accent btn-priority-1');
  });

  it('renders the new Button when useNewButton is true', () => {
    render(<Button {...newProps}>New Button</Button>);
    const button = screen.getByTestId('new-button');
    expect(button).toBeInTheDocument();
    expect(button).toHaveClass('wds-Button wds-Button--medium wds-Button--primary');
  });
});
