import React from 'react'
import { render } from '@testing-library/react'
import Carousel from '../index'

describe('Carousel', () => {
  it('renders without a title or standfirst', () => {
    const { container } = render(
      <Carousel
        content={{
          id: 'carousel-1',
          type: 'carousel',
          children: [],
        }}
      >
        <li>Carousel card</li>
      </Carousel>
    )

    expect(container.firstChild).toMatchSnapshot()
  })

  it('renders with a title but no standfirst', () => {
    const { container } = render(
      <Carousel
        content={{
          id: 'carousel-1',
          type: 'carousel',
          title: 'Inside Business',
          children: [],
        }}
      >
        <li>Carousel card</li>
      </Carousel>
    )

    expect(container.firstChild).toMatchSnapshot()
  })

  it('renders with a title and standfirst', () => {
    const { container } = render(
      <Carousel
        content={{
          id: 'carousel-1',
          type: 'carousel',
          title: 'Inside Business',
          standfirst: 'Analysis and insight from FT specialists',
          children: [],
        }}
      >
        <li>Carousel card</li>
      </Carousel>
    )

    expect(container.firstChild).toMatchSnapshot()
  })
})
