import React from 'react'

import Link from '@instructure/ui-elements/lib/components/Link'

import ReportCard from '../index'

describe('ReportCard', () => {
  const testbed = createTestbed(ReportCard, {
    name: 'Cool report',
    details: <span>Something interesting here</span>,
    href: '/foo'
  })

  shouldRenderComponent(testbed, {}, ReportCard)

  it('should render name', () => {
    testbed.render()

    expect(testbed.getText()).to.include('Cool report')
  })

  it('should render details', () => {
    testbed.render()

    expect(testbed.getText()).to.include('Something interesting here')
  })

  it('should link to href', () => {
    testbed.render()

    const link = testbed.findChildByType(Link)
    expect(link).to.exist()
    expect(link.props.href).to.eq('/foo')
  })

  describe('a11y tests', () => {
    it('should meet a11y standards', (done) => {
      testbed.renderShallowly()
      testbed.checkA11yStandards(done)
    })
  })
})
