import React from 'react'
import { shallow } from 'enzyme'
import Image from '{{FILENAME}}'

const negativeNumberString = expect.stringMatching(/^-/)

describe('{{NAME}}.svg generated styled component', () => {
  it('renders a <svg> tag without crashing', () => {
    const wrapper = shallow(<Image />)
    expect(wrapper).toHaveTagName('svg')
  })

  it('has dimensions greater than zero', () => {
    const dimensions = Image.getDimensions()
    expect(dimensions.width).not.toBe('0')
    expect(dimensions.width).not.toEqual(negativeNumberString)
    expect(dimensions.height).not.toBe('0')
    expect(dimensions.height).not.toEqual(negativeNumberString)
  })
})

import React from 'react'
import { shallow } from 'enzyme'
import toJson from 'enzyme-to-json'
import Image from '{{FILENAME}}'

describe('{{NAME}}.svg generated styled component', () => {
  let wrapper
  beforeEach(() => {
    wrapper = shallow(<Image />)
  })

  it('renders a <svg> tag without crashing', () => {
    expect(wrapper).toHaveTagName('svg')
  })

  it('renders correctly according to snapshot', () => {
    expect(toJson(wrapper)).toMatchSnapshot()
  })

  it('has dimensions greater than zero', () => {
    const dimensions = Image.getDimensions()
    expect(dimensions.width).not.toBe('0')
    expect(parseInt(dimensions.width, 10)).toBeGreaterThan(0)
    expect(dimensions.height).not.toBe('0')
    expect(parseInt(dimensions.height, 10)).toBeGreaterThan(0)
  })
})

add snapshot testing