import React from 'react'
import { mount } from '../../test/utils'

import { Avatar } from '../Avatar'
import { NextImage } from '../..'

describe('<Avatar />', () => {
  describe('image', () => {
    it('renders image component when source is a url', () => {
      const src = 'https://placekitten.com/200/300'
      const avatar = mount(<Avatar alt="Kitten" source={src} />)
      expect(avatar).toContainReactComponent('img', { src: src })
    })

    it('renders next image component when source is and internal path', () => {
      const src = '/'
      const alt = 'Kitten'
      const avatar = mount(<Avatar alt={alt} source={src} />)
      expect(avatar).toContainReactComponent(NextImage, {
        source: src,
        alt: alt
      })
    })
  })
})
