// src/features/flyer/SampleDataButton.test.tsx
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import { SampleDataButton } from './SampleDataButton';

describe('SampleDataButton', () => {
  it('should render the button with the correct text', () => {
    const mockOnClick = vi.fn();
    render(<SampleDataButton onClick={mockOnClick} />);

    const button = screen.getByRole('button', { name: /no flyer\? try with sample data\./i });
    expect(button).toBeInTheDocument();
  });

  it('should call the onClick handler when clicked', () => {
    const mockOnClick = vi.fn();
    render(<SampleDataButton onClick={mockOnClick} />);

    const button = screen.getByRole('button', { name: /no flyer\? try with sample data\./i });
    fireEvent.click(button);

    expect(mockOnClick).toHaveBeenCalledTimes(1);
  });
});