mirror of https://github.com/kremalicious/blog.git
22 lines
657 B
TypeScript
22 lines
657 B
TypeScript
import React from 'react'
|
|
import { render } from '@testing-library/react'
|
|
import Icon from './Icon'
|
|
|
|
describe('Icon', () => {
|
|
it('renders correctly', () => {
|
|
const { container, rerender } = render(<Icon name={'Compass'} />)
|
|
expect(container.firstChild.nodeName).toBe('svg')
|
|
|
|
rerender(<Icon name={'Download'} />)
|
|
expect(container.firstChild.nodeName).toBe('svg')
|
|
|
|
rerender(<Icon name={'Twitter'} />)
|
|
expect(container.firstChild.nodeName).toBe('svg')
|
|
})
|
|
|
|
it('does not render with unknown name', () => {
|
|
const { container } = render(<Icon name={'whatever'} />)
|
|
expect(container.firstChild).not.toBeInTheDocument()
|
|
})
|
|
})
|