import React from 'react';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import TeatimeAndLunchtimeFrame from '.';

describe('TeatimeAndLunchtimeFrame', () => {
  test('renders teatime and lunchtime sections with correct titles and descriptions', () => {
    const { getByText } = render(<TeatimeAndLunchtimeFrame />);

    // Teatime Section
    expect(
      getByText(
        'The Teatime Draw is the second daily lottery draw for the UK49s. It happens every evening from Monday to Sunday.'
      )
    ).toBeInTheDocument();
    expect(
      getByText(
        'Players select between 1 and 5 numbers from a set of 1 to 49. You can also add a bonus "Booster Ball" to increase your chances of winning.'
      )
    ).toBeInTheDocument();
    expect(
      getByText(
        'In the UK, the Teatime Draw takes place at 17:49. The timing in South Africa varies based on daylight savings.'
      )
    ).toBeInTheDocument();
    expect(getByText('UK49s Teatime Draw in South Africa')).toBeInTheDocument();
    expect(
      getByText('18:49 (SA Time) during daylight savings (Late March to Late October)')
    ).toBeInTheDocument();
    expect(
      getByText('19:49 PM (SA Time) outside of daylight savings (Late October to Late March)')
    ).toBeInTheDocument();
    expect(
      getByText(
        'The evening draw closes at 18:45 during daylight savings and 19:45 outside of daylight savings.'
      )
    ).toBeInTheDocument();

    // Lunchtime Section
    expect(
      getByText(
        'The Lunchtime Draw is the first draw of the day for the UK49s. It takes place every afternoon, Monday to Sunday.'
      )
    ).toBeInTheDocument();
    expect(
      getByText(
        'Players choose between 1 and 5 numbers from a pool of 1 to 49. You can also opt to include a "Booster Ball" for extra chances.'
      )
    ).toBeInTheDocument();
    expect(
      getByText(
        'In the UK, the draw takes place at 12:49. In South Africa, the time of the Lunchtime Draw depends on daylight savings.'
      )
    ).toBeInTheDocument();
    expect(getByText('UK49s Lunchtime Draw in South Africa')).toBeInTheDocument();
    expect(
      getByText('13:49 (SA Time) during daylight savings (Late March to Late October)')
    ).toBeInTheDocument();
    expect(
      getByText('14:49 (SA Time) outside of daylight savings (Late October to Late March)')
    ).toBeInTheDocument();
    expect(
      getByText(
        'The afternoon draw closes at 13:45 during daylight savings and 14:45 outside of daylight savings.'
      )
    ).toBeInTheDocument();
  });
});
