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

import { NextImage } from '../NextImage'
import Image from 'next/image'

describe('<NextImage />', () => {
  it('renders a Image component with source as string', () => {
    const src = 'https://placekitten.com/200/300'
    const image = mount(
      <NextImage source={src} alt="alt" height="1" width="1" />
    )
    expect(image).toContainReactComponent(Image)
  })

  it('renders a Image component with source as statically imported image', () => {
    const src = '/1x1.png'
    jest.mock('/1x1.png')
    const image = mount(
      <NextImage source={src} alt="alt" height="1" width="1" />
    )
    expect(image).toContainReactComponent(Image)
  })
})
