
import {ReturnButton} from '../ReturnButton'

describe('ReturnButton', () => {
  const testbed = createTestbed(
    ReturnButton,
    {returnToUrl: null}
  )

  shouldRenderComponent(
    testbed, {}, ReturnButton
  )

  context('without a return url', () => {
    it('should not render the button', () => {
      testbed.render()
      const returnButton = testbed.findChildrenByTagName('a')[0]
      expect(returnButton).not.to.exist()
    })
  })

  context('with a return url', () => {
    it('should render the button', () => {
      testbed.render({returnToUrl: 'https://canvas.com'})
      const returnButton = testbed.findChildrenByTagName('a')[0]
      expect(returnButton).to.exist()
    })
  })
})
